Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
0.00% |
0 / 1200 |
|
0.00% |
0 / 608 |
|
0.00% |
0 / 14111 |
|
0.00% |
0 / 55 |
CRAP | |
0.00% |
0 / 1 |
| PKPTemplateManager | |
0.00% |
0 / 1189 |
|
0.00% |
0 / 608 |
|
0.00% |
0 / 14111 |
|
0.00% |
0 / 55 |
91506 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| initialize | |
0.00% |
0 / 208 |
|
0.00% |
0 / 66 |
|
0.00% |
0 / 4096 |
|
0.00% |
0 / 1 |
1190 | |||
| setCacheability | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| compileLess | |
0.00% |
0 / 16 |
|
0.00% |
0 / 16 |
|
0.00% |
0 / 64 |
|
0.00% |
0 / 1 |
56 | |||
| cacheLess | |
0.00% |
0 / 4 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| getCachedLessFilePath | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| addStyleSheet | |
0.00% |
0 / 14 |
|
0.00% |
0 / 4 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| addJavaScript | |
0.00% |
0 / 14 |
|
0.00% |
0 / 4 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| addHeader | |
0.00% |
0 / 12 |
|
0.00% |
0 / 4 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| setConstants | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getState | |
0.00% |
0 / 3 |
|
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| setState | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| registerJSLibrary | |
0.00% |
0 / 52 |
|
0.00% |
0 / 16 |
|
0.00% |
0 / 64 |
|
0.00% |
0 / 1 |
72 | |||
| registerJSLibraryData | |
0.00% |
0 / 37 |
|
0.00% |
0 / 14 |
|
0.00% |
0 / 24 |
|
0.00% |
0 / 1 |
42 | |||
| setupBackendPage | |
0.00% |
0 / 278 |
|
0.00% |
0 / 86 |
|
0.00% |
0 / 4096 |
|
0.00% |
0 / 1 |
1806 | |||
| fetch | |
0.00% |
0 / 6 |
|
0.00% |
0 / 5 |
|
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
| fetchAjax | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getCompileId | |
0.00% |
0 / 5 |
|
0.00% |
0 / 4 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
12 | |||
| fetchJson | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| display | |
0.00% |
0 / 53 |
|
0.00% |
0 / 16 |
|
0.00% |
0 / 70 |
|
0.00% |
0 / 1 |
110 | |||
| clearTemplateCache | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| clearCssCache | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| clearThemeTemplateCache | |
0.00% |
0 / 5 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| getManager | |
0.00% |
0 / 12 |
|
0.00% |
0 / 8 |
|
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
30 | |||
| getFBV | |
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| displaySidebar | |
0.00% |
0 / 15 |
|
0.00% |
0 / 13 |
|
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
42 | |||
| getTinyMceSkinUrl | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| smartyTranslate | |
0.00% |
0 / 7 |
|
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| smartyHelp | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| smartyHtmlOptionsTranslate | |
0.00% |
0 / 13 |
|
0.00% |
0 / 14 |
|
0.00% |
0 / 40 |
|
0.00% |
0 / 1 |
56 | |||
| smartyIterate | |
0.00% |
0 / 19 |
|
0.00% |
0 / 14 |
|
0.00% |
0 / 24 |
|
0.00% |
0 / 1 |
56 | |||
| smartyPageInfo | |
0.00% |
0 / 18 |
|
0.00% |
0 / 10 |
|
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
30 | |||
| smartyFlush | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| flush | |
0.00% |
0 / 3 |
|
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| smartyCallHook | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| smartyRunHook | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| smartyUrl | |
0.00% |
0 / 27 |
|
0.00% |
0 / 24 |
|
0.00% |
0 / 360 |
|
0.00% |
0 / 1 |
132 | |||
| smartyTitle | |
0.00% |
0 / 9 |
|
0.00% |
0 / 8 |
|
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
20 | |||
| smartyPageLinks | |
0.00% |
0 / 46 |
|
0.00% |
0 / 27 |
|
0.00% |
0 / 800 |
|
0.00% |
0 / 1 |
156 | |||
| smartyCompare | |
0.00% |
0 / 2 |
|
0.00% |
0 / 7 |
|
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
| smartyEscape | |
0.00% |
0 / 11 |
|
0.00% |
0 / 6 |
|
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
20 | |||
| smartyLoadUrlInEl | |
0.00% |
0 / 21 |
|
0.00% |
0 / 12 |
|
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
42 | |||
| smartyLoadUrlInDiv | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| smartyCSRF | |
0.00% |
0 / 6 |
|
0.00% |
0 / 7 |
|
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
30 | |||
| smartyLoadStylesheet | |
0.00% |
0 / 17 |
|
0.00% |
0 / 19 |
|
0.00% |
0 / 36 |
|
0.00% |
0 / 1 |
72 | |||
| loadHtmlGalleyStyles | |
0.00% |
0 / 19 |
|
0.00% |
0 / 21 |
|
0.00% |
0 / 33 |
|
0.00% |
0 / 1 |
90 | |||
| smartyLoadScript | |
0.00% |
0 / 16 |
|
0.00% |
0 / 19 |
|
0.00% |
0 / 36 |
|
0.00% |
0 / 1 |
72 | |||
| smartyLoadHeader | |
0.00% |
0 / 9 |
|
0.00% |
0 / 9 |
|
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
20 | |||
| smartyLoadNavigationMenuArea | |
0.00% |
0 / 31 |
|
0.00% |
0 / 15 |
|
0.00% |
0 / 68 |
|
0.00% |
0 / 1 |
72 | |||
| getResourcesByContext | |
0.00% |
0 / 19 |
|
0.00% |
0 / 19 |
|
0.00% |
0 / 56 |
|
0.00% |
0 / 1 |
72 | |||
| smartyPluckFiles | |
0.00% |
0 / 42 |
|
0.00% |
0 / 38 |
|
0.00% |
0 / 38 |
|
0.00% |
0 / 1 |
380 | |||
| smartyLocaleDirection | |
0.00% |
0 / 2 |
|
0.00% |
0 / 7 |
|
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
| smartyHtmlSelectDateA11y | |
0.00% |
0 / 53 |
|
0.00% |
0 / 38 |
|
0.00% |
0 / 4096 |
|
0.00% |
0 / 1 |
156 | |||
| setHeaders | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getHeaders | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @defgroup template Template |
| 5 | * Implements template management. |
| 6 | */ |
| 7 | |
| 8 | /** |
| 9 | * @file classes/template/PKPTemplateManager.php |
| 10 | * |
| 11 | * Copyright (c) 2014-2021 Simon Fraser University |
| 12 | * Copyright (c) 2000-2021 John Willinsky |
| 13 | * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. |
| 14 | * |
| 15 | * @class PKPTemplateManager |
| 16 | * |
| 17 | * @ingroup template |
| 18 | * |
| 19 | * @brief Class for accessing the underlying template engine. |
| 20 | * Currently integrated with Smarty (from http://smarty.php.net/). |
| 21 | */ |
| 22 | |
| 23 | namespace PKP\template; |
| 24 | |
| 25 | use APP\core\Application; |
| 26 | use APP\core\PageRouter; |
| 27 | use APP\core\Request; |
| 28 | use APP\facades\Repo; |
| 29 | use APP\file\PublicFileManager; |
| 30 | use APP\submission\Submission; |
| 31 | use APP\template\TemplateManager; |
| 32 | use Exception; |
| 33 | use Illuminate\Support\Str; |
| 34 | use Less_Parser; |
| 35 | use PKP\config\Config; |
| 36 | use PKP\context\Context; |
| 37 | use PKP\controllers\grid\GridHandler; |
| 38 | use PKP\controllers\grid\GridRow; |
| 39 | use PKP\controllers\listbuilder\ListbuilderHandler; |
| 40 | use PKP\core\Core; |
| 41 | use PKP\core\JSONMessage; |
| 42 | use PKP\core\PKPApplication; |
| 43 | use PKP\core\PKPRequest; |
| 44 | use PKP\core\PKPSessionGuard; |
| 45 | use PKP\core\PKPString; |
| 46 | use PKP\core\Registry; |
| 47 | use PKP\db\DAORegistry; |
| 48 | use PKP\facades\Locale; |
| 49 | use PKP\file\FileManager; |
| 50 | use PKP\form\FormBuilderVocabulary; |
| 51 | use PKP\navigationMenu\NavigationMenuDAO; |
| 52 | use PKP\notification\Notification; |
| 53 | use PKP\plugins\Hook; |
| 54 | use PKP\plugins\PluginRegistry; |
| 55 | use PKP\plugins\ThemePlugin; |
| 56 | use PKP\security\Role; |
| 57 | use PKP\security\Validation; |
| 58 | use PKP\site\VersionDAO; |
| 59 | use PKP\submission\GenreDAO; |
| 60 | use PKP\submission\PKPSubmission; |
| 61 | use PKP\submissionFile\SubmissionFile; |
| 62 | use Smarty; |
| 63 | use Smarty_Internal_Template; |
| 64 | |
| 65 | require_once('./lib/pkp/lib/vendor/smarty/smarty/libs/plugins/modifier.escape.php'); // Seems to be needed? |
| 66 | |
| 67 | /* This definition is required by Smarty */ |
| 68 | define('SMARTY_DIR', Core::getBaseDir() . '/lib/pkp/lib/vendor/smarty/smarty/libs/'); |
| 69 | |
| 70 | class PKPTemplateManager extends Smarty |
| 71 | { |
| 72 | public const CACHEABILITY_NO_CACHE = 'no-cache'; |
| 73 | public const CACHEABILITY_NO_STORE = 'no-store'; |
| 74 | public const CACHEABILITY_PUBLIC = 'public'; |
| 75 | public const CACHEABILITY_MUST_REVALIDATE = 'must-revalidate'; |
| 76 | public const CACHEABILITY_PROXY_REVALIDATE = 'proxy-revalidate'; |
| 77 | |
| 78 | public const STYLE_SEQUENCE_CORE = 0; |
| 79 | public const STYLE_SEQUENCE_NORMAL = 10; |
| 80 | public const STYLE_SEQUENCE_LATE = 15; |
| 81 | public const STYLE_SEQUENCE_LAST = 20; |
| 82 | |
| 83 | public const CSS_FILENAME_SUFFIX = 'css'; |
| 84 | |
| 85 | public const PAGE_WIDTH_NARROW = 'narrow'; |
| 86 | public const PAGE_WIDTH_NORMAL = 'normal'; |
| 87 | public const PAGE_WIDTH_WIDE = 'wide'; |
| 88 | public const PAGE_WIDTH_FULL = 'full'; |
| 89 | |
| 90 | /** @var array of URLs to stylesheets */ |
| 91 | private array $_styleSheets = []; |
| 92 | |
| 93 | /** @var array of URLs to javascript files */ |
| 94 | private array $_javaScripts = []; |
| 95 | |
| 96 | /** @var array of HTML head content to output */ |
| 97 | private array $_htmlHeaders = []; |
| 98 | |
| 99 | /** @var array Key/value list of constants to expose in the JS interface */ |
| 100 | private array $_constants = []; |
| 101 | |
| 102 | /** @var array Initial state data to be managed by the page's Vue.js component */ |
| 103 | protected array $_state = []; |
| 104 | |
| 105 | /** @var string Type of cacheability (Cache-Control). */ |
| 106 | private string $_cacheability = self::CACHEABILITY_NO_STORE; // Safe default |
| 107 | |
| 108 | /** @var object The form builder vocabulary class. */ |
| 109 | private FormBuilderVocabulary $_fbv; |
| 110 | |
| 111 | /** */ |
| 112 | private PKPRequest $_request; |
| 113 | |
| 114 | /** @var string[] */ |
| 115 | private array $headers = []; |
| 116 | |
| 117 | /** |
| 118 | * Constructor. |
| 119 | * Initialize template engine and assign basic template variables. |
| 120 | */ |
| 121 | public function __construct() |
| 122 | { |
| 123 | parent::__construct(); |
| 124 | |
| 125 | // Set up Smarty configuration |
| 126 | $cachePath = Core::getBaseDir() . '/cache'; |
| 127 | $this->compile_dir = "{$cachePath}/t_compile"; |
| 128 | $this->config_dir = "{$cachePath}/t_config"; |
| 129 | $this->cache_dir = "{$cachePath}/t_cache"; |
| 130 | |
| 131 | // Register the template resources. |
| 132 | $this->registerResource('core', new PKPTemplateResource($coreTemplateDir = 'lib/pkp/templates')); |
| 133 | $this->registerResource('app', new PKPTemplateResource(['templates', $coreTemplateDir])); |
| 134 | $this->default_resource_type = 'app'; |
| 135 | |
| 136 | $this->error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING; |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * Initialize the template manager. |
| 141 | */ |
| 142 | public function initialize(PKPRequest $request) |
| 143 | { |
| 144 | $this->_request = $request; |
| 145 | |
| 146 | $locale = Locale::getLocale(); |
| 147 | $application = Application::get(); |
| 148 | $router = $request->getRouter(); |
| 149 | $currentContext = $request->getContext(); |
| 150 | |
| 151 | $this->assign([ |
| 152 | 'defaultCharset' => 'utf-8', |
| 153 | 'baseUrl' => $request->getBaseUrl(), |
| 154 | 'currentContext' => $currentContext, |
| 155 | 'currentLocale' => $locale, |
| 156 | 'currentLocaleLangDir' => Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr', |
| 157 | 'applicationName' => __($application->getNameKey()), |
| 158 | ]); |
| 159 | |
| 160 | // Assign date and time format |
| 161 | if ($currentContext) { |
| 162 | $this->assign([ |
| 163 | 'dateFormatShort' => PKPString::convertStrftimeFormat($currentContext->getLocalizedDateFormatShort()), |
| 164 | 'dateFormatLong' => PKPString::convertStrftimeFormat($currentContext->getLocalizedDateFormatLong()), |
| 165 | 'datetimeFormatShort' => PKPString::convertStrftimeFormat($currentContext->getLocalizedDateTimeFormatShort()), |
| 166 | 'datetimeFormatLong' => PKPString::convertStrftimeFormat($currentContext->getLocalizedDateTimeFormatLong()), |
| 167 | 'timeFormat' => PKPString::convertStrftimeFormat($currentContext->getLocalizedTimeFormat()), |
| 168 | 'displayPageHeaderTitle' => $currentContext->getLocalizedData('name'), |
| 169 | 'displayPageHeaderLogo' => $currentContext->getLocalizedData('pageHeaderLogoImage'), |
| 170 | 'displayPageHeaderLogoAltText' => $currentContext->getLocalizedData('pageHeaderLogoImageAltText'), |
| 171 | ]); |
| 172 | } else { |
| 173 | $this->assign([ |
| 174 | 'dateFormatShort' => PKPString::convertStrftimeFormat(Config::getVar('general', 'date_format_short')), |
| 175 | 'dateFormatLong' => PKPString::convertStrftimeFormat(Config::getVar('general', 'date_format_long')), |
| 176 | 'datetimeFormatShort' => PKPString::convertStrftimeFormat(Config::getVar('general', 'datetime_format_short')), |
| 177 | 'datetimeFormatLong' => PKPString::convertStrftimeFormat(Config::getVar('general', 'datetime_format_long')), |
| 178 | 'timeFormat' => PKPString::convertStrftimeFormat(Config::getVar('general', 'time_format')), |
| 179 | ]); |
| 180 | } |
| 181 | |
| 182 | if (Application::isInstalled() && !$currentContext) { |
| 183 | $site = $request->getSite(); |
| 184 | $this->assign([ |
| 185 | 'displayPageHeaderTitle' => $site->getLocalizedTitle(), |
| 186 | 'displayPageHeaderLogo' => $site->getLocalizedData('pageHeaderTitleImage'), |
| 187 | ]); |
| 188 | } |
| 189 | |
| 190 | // Assign meta tags |
| 191 | if ($currentContext) { |
| 192 | $favicon = $currentContext->getLocalizedFavicon(); |
| 193 | if (!empty($favicon)) { |
| 194 | $publicFileManager = new PublicFileManager(); |
| 195 | $faviconDir = $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath($currentContext->getId()); |
| 196 | $this->addHeader('favicon', '<link rel="icon" href="' . $faviconDir . '/' . $favicon['uploadName'] . '">', ['contexts' => ['frontend', 'backend']]); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | if (Application::isInstalled()) { |
| 201 | $activeTheme = null; |
| 202 | $contextOrSite = $currentContext ? $currentContext : $request->getSite(); |
| 203 | $allThemes = PluginRegistry::getPlugins('themes'); |
| 204 | foreach ($allThemes as $theme) { |
| 205 | if ($contextOrSite->getData('themePluginPath') === $theme->getDirName()) { |
| 206 | $activeTheme = $theme; |
| 207 | break; |
| 208 | } |
| 209 | } |
| 210 | $this->assign(['activeTheme' => $activeTheme]); |
| 211 | } |
| 212 | |
| 213 | if ($router instanceof \PKP\core\PKPPageRouter) { |
| 214 | $this->assign([ |
| 215 | 'requestedPage' => $router->getRequestedPage($request), |
| 216 | 'requestedOp' => $router->getRequestedOp($request), |
| 217 | ]); |
| 218 | |
| 219 | // A user-uploaded stylesheet |
| 220 | if ($currentContext) { |
| 221 | $contextStyleSheet = $currentContext->getData('styleSheet'); |
| 222 | if ($contextStyleSheet) { |
| 223 | $publicFileManager = new PublicFileManager(); |
| 224 | $this->addStyleSheet( |
| 225 | 'contextStylesheet', |
| 226 | $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath($currentContext->getId()) . '/' . $contextStyleSheet['uploadName'] . '?d=' . urlencode($contextStyleSheet['dateUploaded']), |
| 227 | ['priority' => self::STYLE_SEQUENCE_LATE] |
| 228 | ); |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | // Register recaptcha on relevant pages |
| 233 | if (Config::getVar('captcha', 'recaptcha')) { |
| 234 | $contexts = []; |
| 235 | if (Config::getVar('captcha', 'captcha_on_register')) { |
| 236 | array_push($contexts, 'frontend-user-register', 'frontend-user-registerUser'); |
| 237 | } |
| 238 | if (Config::getVar('captcha', 'captcha_on_login')) { |
| 239 | array_push($contexts, 'frontend-login-index', 'frontend-login-signIn'); |
| 240 | } |
| 241 | if (count($contexts)) { |
| 242 | $this->addJavaScript( |
| 243 | 'recaptcha', |
| 244 | 'https://www.google.com/recaptcha/api.js?hl=' . substr(Locale::getLocale(), 0, 2), |
| 245 | [ |
| 246 | 'contexts' => $contexts, |
| 247 | ] |
| 248 | ); |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | // Register meta tags |
| 253 | if (Application::isInstalled()) { |
| 254 | if (($request->getRequestedPage() == '' || $request->getRequestedPage() == 'index') && $currentContext && $currentContext->getLocalizedData('searchDescription')) { |
| 255 | $this->addHeader('searchDescription', '<meta name="description" content="' . $currentContext->getLocalizedData('searchDescription') . '">'); |
| 256 | } |
| 257 | |
| 258 | $this->addHeader( |
| 259 | 'generator', |
| 260 | '<meta name="generator" content="' . __($application->getNameKey()) . ' ' . $application->getCurrentVersion()->getVersionString(false) . '">', |
| 261 | [ |
| 262 | 'contexts' => ['frontend', 'backend'], |
| 263 | ] |
| 264 | ); |
| 265 | |
| 266 | if ($currentContext) { |
| 267 | $customHeaders = $currentContext->getLocalizedData('customHeaders'); |
| 268 | if (!empty($customHeaders)) { |
| 269 | $this->addHeader('customHeaders', $customHeaders); |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | if (count($supportedLocales = $currentContext?->getSupportedLocales() ?? $site->getSupportedLocales()) > 1) { |
| 274 | (function () use ($request, $router, $supportedLocales) { |
| 275 | $page = $router->getRequestedPage($request); |
| 276 | $op = $router->getRequestedOp($request); |
| 277 | $path = $router->getRequestedArgs($request); |
| 278 | $url = fn (string $locale = ''): string => $router->url($request, null, $page, $op, $path, urlLocaleForPage: $locale); |
| 279 | collect($supportedLocales) |
| 280 | ->each(fn (string $l) => $this->addHeader("language-{$l}", "<link rel='alternate' hreflang='" . str_replace(['_', '@cyrillic', '@latin'], ['-', '-Cyrl', '-Latn'], $l) . "' href='" . $url($l) . "' />")); |
| 281 | $this->addHeader('language-xdefault', "<link rel='alternate' hreflang='x-default' href='" . $url() . "' />"); |
| 282 | })(); |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | if ($currentContext && !$currentContext->getEnabled()) { |
| 287 | $this->addHeader( |
| 288 | 'noindex', |
| 289 | '<meta name="robots" content="noindex,nofollow">', |
| 290 | [ |
| 291 | 'contexts' => ['frontend', 'backend'], |
| 292 | ] |
| 293 | ); |
| 294 | } |
| 295 | |
| 296 | // Register Navigation Menus |
| 297 | $nmService = app()->get('navigationMenu'); |
| 298 | |
| 299 | if (Application::isInstalled()) { |
| 300 | Hook::add('LoadHandler', $nmService->_callbackHandleCustomNavigationMenuItems(...)); |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | // Register classes that need to expose class constants to templates. FIXME: This should be done closer to usage. |
| 305 | foreach ([PKPApplication::class, Application::class, Role::class, Submission::class, PKPSubmission::class, Locale::class, SubmissionFile::class, GridHandler::class, GridRow::class] as $fqcn) { |
| 306 | $this->registerClass($fqcn, $fqcn); |
| 307 | } |
| 308 | |
| 309 | // Register custom functions |
| 310 | $this->registerPlugin('modifier', 'is_numeric', is_numeric(...)); |
| 311 | $this->registerPlugin('modifier', 'get_class', get_class(...)); |
| 312 | $this->registerPlugin('modifier', 'is_a', is_a(...)); |
| 313 | $this->registerPlugin('modifier', 'count', count(...)); |
| 314 | $this->registerPlugin('modifier', 'intval', intval(...)); |
| 315 | $this->registerPlugin('modifier', 'json_encode', json_encode(...)); |
| 316 | $this->registerPlugin('modifier', 'uniqid', uniqid(...)); |
| 317 | $this->registerPlugin('modifier', 'substr', substr(...)); |
| 318 | $this->registerPlugin('modifier', 'strstr', strstr(...)); |
| 319 | $this->registerPlugin('modifier', 'strval', strval(...)); |
| 320 | $this->registerPlugin('modifier', 'substr_replace', substr_replace(...)); |
| 321 | $this->registerPlugin('modifier', 'array_reverse', array_reverse(...)); |
| 322 | $this->registerPlugin('modifier', 'array_intersect', array_intersect(...)); |
| 323 | $this->registerPlugin('modifier', 'array_key_exists', array_key_exists(...)); |
| 324 | $this->registerPlugin('modifier', 'array_key_first', array_key_first(...)); |
| 325 | $this->registerPlugin('modifier', 'array_values', array_values(...)); |
| 326 | $this->registerPlugin('modifier', 'translate', __(...)); |
| 327 | $this->registerPlugin('modifier', 'strip_unsafe_html', \PKP\core\PKPString::stripUnsafeHtml(...)); |
| 328 | $this->registerPlugin('modifier', 'parse_url', parse_url(...)); |
| 329 | $this->registerPlugin('modifier', 'parse_str', parse_str(...)); |
| 330 | $this->registerPlugin('modifier', 'strtok', strtok(...)); |
| 331 | $this->registerPlugin('modifier', 'array_pop', array_pop(...)); |
| 332 | $this->registerPlugin('modifier', 'array_keys', array_keys(...)); |
| 333 | $this->registerPlugin('modifier', 'String_substr', Str::substr(...)); |
| 334 | $this->registerPlugin('modifier', 'dateformatPHP2JQueryDatepicker', \PKP\core\PKPString::dateformatPHP2JQueryDatepicker(...)); |
| 335 | $this->registerPlugin('modifier', 'to_array', fn () => func_get_args()); |
| 336 | $this->registerPlugin('modifier', 'compare', $this->smartyCompare(...)); |
| 337 | $this->registerPlugin('modifier', 'concat', fn (...$args) => implode('', $args)); |
| 338 | $this->registerPlugin('modifier', 'strtotime', strtotime(...)); |
| 339 | $this->registerPlugin('modifier', 'explode', explode(...)); |
| 340 | $this->registerPlugin('modifier', 'escape', $this->smartyEscape(...)); |
| 341 | $this->registerPlugin('function', 'constant', constant(...)); |
| 342 | $this->registerPlugin('function', 'csrf', $this->smartyCSRF(...)); |
| 343 | $this->registerPlugin('function', 'translate', $this->smartyTranslate(...)); |
| 344 | $this->registerPlugin('function', 'help', $this->smartyHelp(...)); |
| 345 | $this->registerPlugin('function', 'flush', $this->smartyFlush(...)); |
| 346 | $this->registerPlugin('function', 'call_hook', $this->smartyCallHook(...)); |
| 347 | $this->registerPlugin('function', 'run_hook', $this->smartyRunHook(...)); |
| 348 | $this->registerPlugin('function', 'html_options_translate', $this->smartyHtmlOptionsTranslate(...)); |
| 349 | $this->registerPlugin('block', 'iterate', $this->smartyIterate(...)); |
| 350 | $this->registerPlugin('function', 'page_links', $this->smartyPageLinks(...)); |
| 351 | $this->registerPlugin('function', 'page_info', $this->smartyPageInfo(...)); |
| 352 | $this->registerPlugin('function', 'pluck_files', $this->smartyPluckFiles(...)); |
| 353 | $this->registerPlugin('function', 'locale_direction', $this->smartyLocaleDirection(...)); |
| 354 | $this->registerPlugin('function', 'html_select_date_a11y', $this->smartyHtmlSelectDateA11y(...)); |
| 355 | |
| 356 | $this->registerPlugin('function', 'title', $this->smartyTitle(...)); |
| 357 | $this->registerPlugin('function', 'url', $this->smartyUrl(...)); |
| 358 | |
| 359 | // load stylesheets/scripts/headers from a given context |
| 360 | $this->registerPlugin('function', 'load_stylesheet', $this->smartyLoadStylesheet(...)); |
| 361 | $this->registerPlugin('function', 'load_script', $this->smartyLoadScript(...)); |
| 362 | $this->registerPlugin('function', 'load_header', $this->smartyLoadHeader(...)); |
| 363 | |
| 364 | // load NavigationMenu Areas from context |
| 365 | $this->registerPlugin('function', 'load_menu', $this->smartyLoadNavigationMenuArea(...)); |
| 366 | |
| 367 | // Load form builder vocabulary |
| 368 | $fbv = $this->getFBV(); |
| 369 | $this->registerPlugin('block', 'fbvFormSection', $fbv->smartyFBVFormSection(...)); |
| 370 | $this->registerPlugin('block', 'fbvFormArea', $fbv->smartyFBVFormArea(...)); |
| 371 | $this->registerPlugin('function', 'fbvFormButtons', $fbv->smartyFBVFormButtons(...)); |
| 372 | $this->registerPlugin('function', 'fbvElement', $fbv->smartyFBVElement(...)); |
| 373 | $this->registerPlugin('function', 'fieldLabel', $fbv->smartyFieldLabel(...)); |
| 374 | $this->assign('fbvStyles', $fbv->getStyles()); |
| 375 | |
| 376 | // ajax load into a div or any element |
| 377 | $this->registerPlugin('function', 'load_url_in_el', $this->smartyLoadUrlInEl(...)); |
| 378 | $this->registerPlugin('function', 'load_url_in_div', $this->smartyLoadUrlInDiv(...)); |
| 379 | |
| 380 | // Always pass these ListBuilder constants to the browser |
| 381 | // because a ListBuilder may be loaded in an ajax request |
| 382 | // and won't have an opportunity to pass its constants to |
| 383 | // the template manager. This is not a recommended practice, |
| 384 | // but these are the only constants from a controller that are |
| 385 | // required on the frontend. We can remove them once the |
| 386 | // ListBuilderHandler is no longer needed. |
| 387 | $this->setConstants([ |
| 388 | 'LISTBUILDER_SOURCE_TYPE_TEXT' => ListbuilderHandler::LISTBUILDER_SOURCE_TYPE_TEXT, |
| 389 | 'LISTBUILDER_SOURCE_TYPE_SELECT' => ListbuilderHandler::LISTBUILDER_SOURCE_TYPE_SELECT, |
| 390 | 'LISTBUILDER_OPTGROUP_LABEL' => ListbuilderHandler::LISTBUILDER_OPTGROUP_LABEL, |
| 391 | ]); |
| 392 | |
| 393 | /** |
| 394 | * Kludge to make sure no code that tries to connect to the |
| 395 | * database is executed (e.g., when loading installer pages). |
| 396 | */ |
| 397 | if (!PKPSessionGuard::isSessionDisable()) { |
| 398 | $this->assign([ |
| 399 | 'isUserLoggedIn' => Validation::isLoggedIn(), |
| 400 | 'isUserLoggedInAs' => (bool) Validation::loggedInAs(), |
| 401 | 'itemsPerPage' => Config::getVar('interface', 'items_per_page'), |
| 402 | 'numPageLinks' => Config::getVar('interface', 'page_links'), |
| 403 | 'siteTitle' => $request->getSite()->getLocalizedData('title'), |
| 404 | ]); |
| 405 | |
| 406 | $user = $request->getUser(); |
| 407 | if ($user) { |
| 408 | $unreadNotificationCount = Notification::withRead(false) |
| 409 | ->withUserId($user->getId()) |
| 410 | ->withLevel(Notification::NOTIFICATION_LEVEL_TASK) |
| 411 | ->count(); |
| 412 | $this->assign([ |
| 413 | 'currentUser' => $user, |
| 414 | // Assign the user name to be used in the sitenav |
| 415 | 'loggedInUsername' => $user->getUsername(), |
| 416 | // Assign a count of unread tasks |
| 417 | 'unreadNotificationCount' => $unreadNotificationCount |
| 418 | ]); |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | if (Application::isInstalled()) { |
| 423 | // Respond to the sidebar hook |
| 424 | if ($currentContext) { |
| 425 | $this->assign('hasSidebar', !empty($currentContext->getData('sidebar'))); |
| 426 | } else { |
| 427 | $this->assign('hasSidebar', !empty($request->getSite()->getData('sidebar'))); |
| 428 | } |
| 429 | Hook::add('Templates::Common::Sidebar', $this->displaySidebar(...)); |
| 430 | |
| 431 | // Clear the cache whenever the active theme is changed |
| 432 | Hook::add('Context::edit', $this->clearThemeTemplateCache(...)); |
| 433 | Hook::add('Site::edit', $this->clearThemeTemplateCache(...)); |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | |
| 438 | /** |
| 439 | * Flag the page as cacheable (or not). |
| 440 | */ |
| 441 | public function setCacheability(string $cacheability = self::CACHEABILITY_PUBLIC): void |
| 442 | { |
| 443 | $this->_cacheability = $cacheability; |
| 444 | } |
| 445 | |
| 446 | /** |
| 447 | * Compile a LESS stylesheet |
| 448 | * |
| 449 | * @param string $name Unique name for this LESS stylesheet |
| 450 | * @param string $lessFile Path to the LESS file to compile |
| 451 | * @param array $args Optional arguments. Supports: |
| 452 | * 'baseUrl': Base URL to use when rewriting URLs in the LESS file. |
| 453 | * 'addLess': Array of additional LESS files to parse before compiling |
| 454 | * |
| 455 | * @return string Compiled CSS styles |
| 456 | * |
| 457 | * @hook PageHandler::compileLess [[&$less, &$lessFile, &$args, $name, $request]] |
| 458 | */ |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 494 | |
| 495 | /** |
| 496 | * Save LESS styles to a cached file |
| 497 | * |
| 498 | * @param string $path File path to save the compiled styles |
| 499 | * @param string $styles CSS styles compiled from the LESS |
| 500 | */ |
| 501 | public function cacheLess(string $path, string $styles): bool |
| 502 | { |
| 503 | if (file_put_contents($path, $styles) === false) { |
| 504 | error_log("Unable to write \"{$path}\"."); |
| 505 | return false; |
| 506 | } |
| 507 | |
| 508 | return true; |
| 509 | } |
| 510 | |
| 511 | /** |
| 512 | * Retrieve the file path for a cached LESS file |
| 513 | * |
| 514 | * @param string $name Unique identifier for the LESS file |
| 515 | */ |
| 516 | public function getCachedLessFilePath(string $name): string |
| 517 | { |
| 518 | $directory = Core::getBaseDir() . '/cache'; |
| 519 | $contextId = $this->_request->getContext()?->getId() ?? PKPApplication::CONTEXT_SITE; |
| 520 | $hash = crc32($this->_request->getBaseUrl()); |
| 521 | return "{$directory}/{$contextId}-{$name}-{$hash}.css"; |
| 522 | } |
| 523 | |
| 524 | /** |
| 525 | * Register a stylesheet with the style handler |
| 526 | * |
| 527 | * @param string $name Unique identifier for the stylesheet |
| 528 | * @param string $style The stylesheet to be included. Should be a URL |
| 529 | * or, if the `inline` argument is included, stylesheet data to be output. |
| 530 | * @param array $args Key/value array defining display details |
| 531 | * `priority` int The order in which to print this stylesheet. |
| 532 | * Default: STYLE_SEQUENCE_NORMAL |
| 533 | * `contexts` string|array Where the stylesheet should be loaded. |
| 534 | * Default: array('frontend') |
| 535 | * `inline` bool Whether the $stylesheet value should be output directly as |
| 536 | * stylesheet data. Used to pass backend data to the scripts. |
| 537 | */ |
| 538 | public function addStyleSheet(string $name, string $style, array $args = []): void |
| 539 | { |
| 540 | $args = array_merge( |
| 541 | [ |
| 542 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 543 | 'contexts' => ['frontend'], |
| 544 | 'inline' => false, |
| 545 | ], |
| 546 | $args |
| 547 | ); |
| 548 | |
| 549 | $args['contexts'] = (array) $args['contexts']; |
| 550 | foreach ($args['contexts'] as $context) { |
| 551 | $this->_styleSheets[$context][$args['priority']][$name] = [ |
| 552 | 'style' => $style, |
| 553 | 'inline' => $args['inline'], |
| 554 | ]; |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | /** |
| 559 | * Register a script with the script handler |
| 560 | * |
| 561 | * @param string $name Unique identifier for the script |
| 562 | * @param string $script The script to be included. Should be a URL or, if |
| 563 | * the `inline` argument is included, script data to be output. |
| 564 | * @param array $args Key/value array defining display details |
| 565 | * `priority` int The order in which to print this script. |
| 566 | * Default: STYLE_SEQUENCE_NORMAL |
| 567 | * `contexts` string|array Where the script should be loaded. |
| 568 | * Default: array('frontend') |
| 569 | * `inline` bool Whether the $script value should be output directly as |
| 570 | * script data. Used to pass backend data to the scripts. |
| 571 | */ |
| 572 | public function addJavaScript(string $name, string $script, array $args = []): void |
| 573 | { |
| 574 | $args = array_merge( |
| 575 | [ |
| 576 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 577 | 'contexts' => ['frontend'], |
| 578 | 'inline' => false, |
| 579 | ], |
| 580 | $args |
| 581 | ); |
| 582 | |
| 583 | $args['contexts'] = (array) $args['contexts']; |
| 584 | foreach ($args['contexts'] as $context) { |
| 585 | $this->_javaScripts[$context][$args['priority']][$name] = [ |
| 586 | 'script' => $script, |
| 587 | 'inline' => $args['inline'], |
| 588 | ]; |
| 589 | } |
| 590 | } |
| 591 | |
| 592 | /** |
| 593 | * Add a page-specific item to the <head>. |
| 594 | * |
| 595 | * @param string $name Unique identifier for the header |
| 596 | * @param string $header The header to be included. |
| 597 | * @param array $args Key/value array defining display details |
| 598 | * `priority` int The order in which to print this header. |
| 599 | * Default: STYLE_SEQUENCE_NORMAL |
| 600 | * `contexts` string|array Where the header should be loaded. |
| 601 | * Default: array('frontend') |
| 602 | */ |
| 603 | public function addHeader(string $name, string $header, array $args = []): void |
| 604 | { |
| 605 | $args = array_merge( |
| 606 | [ |
| 607 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 608 | 'contexts' => ['frontend'], |
| 609 | ], |
| 610 | $args |
| 611 | ); |
| 612 | |
| 613 | $args['contexts'] = (array) $args['contexts']; |
| 614 | foreach ($args['contexts'] as $context) { |
| 615 | $this->_htmlHeaders[$context][$args['priority']][$name] = [ |
| 616 | 'header' => $header, |
| 617 | ]; |
| 618 | } |
| 619 | } |
| 620 | |
| 621 | /** |
| 622 | * Set constants to be exposed in JavaScript at pkp.const.<constant> |
| 623 | * |
| 624 | * @param array $constants Associative array of constant names to values |
| 625 | */ |
| 626 | public function setConstants(array $constants): void |
| 627 | { |
| 628 | $this->_constants = array_merge($this->_constants, $constants); |
| 629 | } |
| 630 | |
| 631 | /** |
| 632 | * Get a piece of the state data |
| 633 | */ |
| 634 | public function getState(string $key): mixed |
| 635 | { |
| 636 | return array_key_exists($key, $this->_state) |
| 637 | ? $this->_state[$key] |
| 638 | : null; |
| 639 | } |
| 640 | |
| 641 | /** |
| 642 | * Set initial state data to be managed by the Vue.js component on this page |
| 643 | */ |
| 644 | public function setState(array $data) |
| 645 | { |
| 646 | $this->_state = array_merge($this->_state, $data); |
| 647 | } |
| 648 | |
| 649 | /** |
| 650 | * Register all files required by the core JavaScript library |
| 651 | */ |
| 652 | public function registerJSLibrary(): void |
| 653 | { |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 715 | } |
| 716 | |
| 717 | // Otherwise retrieve and register all script files |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 725 | |
| 726 | /** |
| 727 | * Register JavaScript data used by the core JS library |
| 728 | * |
| 729 | * This function registers script data that is required by the core JS |
| 730 | * library. This data is queued after jQuery but before the pkp-lib |
| 731 | * framework, allowing dynamic data to be passed to the framework. It is |
| 732 | * intended to be used for passing constants and locale strings, but plugins |
| 733 | * may also take advantage of a hook to include data required by their own |
| 734 | * scripts, when integrating with the pkp-lib framework. |
| 735 | */ |
| 736 | public function registerJSLibraryData(): void |
| 737 | { |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 758 | $allLocales = array_merge( |
| 759 | $context->getSupportedLocales() ?? [], |
| 760 | $context->getSupportedFormLocales() ?? [], |
| 761 | $context->getSupportedSubmissionLocales() ?? [], |
| 762 | $context->getSupportedSubmissionMetadataLocales() ?? [], |
| 763 | ); |
| 764 | } else { |
| 765 | $allLocales = $this->_request->getSite()->getSupportedLocales(); |
| 766 | } |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 790 | |
| 791 | /** |
| 792 | * Set up the template requirements for editorial backend pages |
| 793 | * |
| 794 | * @hook TemplateManager::setupBackendPage [] |
| 795 | */ |
| 796 | public function setupBackendPage() |
| 797 | { |
| 798 | $request = Application::get()->getRequest(); |
| 799 | $dispatcher = $request->getDispatcher(); |
| 800 | /** @var PageRouter */ |
| 801 | $router = $request->getRouter(); |
| 802 | |
| 803 | if (empty($this->getTemplateVars('pageComponent'))) { |
| 804 | $this->assign('pageComponent', 'Page'); |
| 805 | } |
| 806 | |
| 807 | $this->setConstants([ |
| 808 | 'REALLY_BIG_NUMBER' => REALLY_BIG_NUMBER, |
| 809 | 'UPLOAD_MAX_FILESIZE' => UPLOAD_MAX_FILESIZE, |
| 810 | 'WORKFLOW_STAGE_ID_PUBLISHED' => WORKFLOW_STAGE_ID_PUBLISHED, |
| 811 | 'WORKFLOW_STAGE_ID_SUBMISSION' => WORKFLOW_STAGE_ID_SUBMISSION, |
| 812 | 'WORKFLOW_STAGE_ID_INTERNAL_REVIEW' => WORKFLOW_STAGE_ID_INTERNAL_REVIEW, |
| 813 | 'WORKFLOW_STAGE_ID_EXTERNAL_REVIEW' => WORKFLOW_STAGE_ID_EXTERNAL_REVIEW, |
| 814 | 'WORKFLOW_STAGE_ID_EDITING' => WORKFLOW_STAGE_ID_EDITING, |
| 815 | 'WORKFLOW_STAGE_ID_PRODUCTION' => WORKFLOW_STAGE_ID_PRODUCTION, |
| 816 | 'INSERT_TAG_VARIABLE_TYPE_PLAIN_TEXT' => INSERT_TAG_VARIABLE_TYPE_PLAIN_TEXT, |
| 817 | 'ROLE_ID_MANAGER' => Role::ROLE_ID_MANAGER, |
| 818 | 'ROLE_ID_SITE_ADMIN' => Role::ROLE_ID_SITE_ADMIN, |
| 819 | 'ROLE_ID_AUTHOR' => Role::ROLE_ID_AUTHOR, |
| 820 | 'ROLE_ID_REVIEWER' => Role::ROLE_ID_REVIEWER, |
| 821 | 'ROLE_ID_ASSISTANT' => Role::ROLE_ID_ASSISTANT, |
| 822 | 'ROLE_ID_READER' => Role::ROLE_ID_READER, |
| 823 | 'ROLE_ID_SUB_EDITOR' => Role::ROLE_ID_SUB_EDITOR, |
| 824 | 'ROLE_ID_SUBSCRIPTION_MANAGER' => Role::ROLE_ID_SUBSCRIPTION_MANAGER, |
| 825 | 'STATUS_QUEUED' => Submission::STATUS_QUEUED, |
| 826 | 'STATUS_PUBLISHED' => Submission::STATUS_PUBLISHED, |
| 827 | 'STATUS_DECLINED' => Submission::STATUS_DECLINED, |
| 828 | 'STATUS_SCHEDULED' => Submission::STATUS_SCHEDULED, |
| 829 | ]); |
| 830 | |
| 831 | |
| 832 | |
| 833 | $hash = Locale::getUITranslator()->getCacheHash(); |
| 834 | $this->addJavaScript( |
| 835 | 'i18n_keys', |
| 836 | $request->getDispatcher()->url($request, Application::ROUTE_API, $request->getContext()?->getPath() ?? Application::SITE_CONTEXT_PATH, '_i18n/ui.js?hash=' . $hash), |
| 837 | [ |
| 838 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 839 | 'contexts' => 'backend', |
| 840 | ] |
| 841 | ); |
| 842 | |
| 843 | // Set up the document type icons |
| 844 | $documentTypeIcons = [ |
| 845 | FileManager::DOCUMENT_TYPE_DEFAULT => 'DefaultDocument', |
| 846 | FileManager::DOCUMENT_TYPE_AUDIO => 'FileAudio', |
| 847 | FileManager::DOCUMENT_TYPE_EPUB => 'FileEpub', |
| 848 | FileManager::DOCUMENT_TYPE_EXCEL => 'FileExcel', |
| 849 | FileManager::DOCUMENT_TYPE_HTML => 'FileHtml', |
| 850 | FileManager::DOCUMENT_TYPE_IMAGE => 'FileImage', |
| 851 | FileManager::DOCUMENT_TYPE_PDF => 'FilePdf', |
| 852 | FileManager::DOCUMENT_TYPE_WORD => 'FileDoc', |
| 853 | FileManager::DOCUMENT_TYPE_VIDEO => 'FileVideo', |
| 854 | FileManager::DOCUMENT_TYPE_ZIP => 'FileZip', |
| 855 | FileManager::DOCUMENT_TYPE_URL => 'Url', |
| 856 | ]; |
| 857 | $this->addJavaScript( |
| 858 | 'documentTypeIcons', |
| 859 | 'pkp.documentTypeIcons = ' . json_encode($documentTypeIcons) . ';', |
| 860 | [ |
| 861 | 'priority' => self::STYLE_SEQUENCE_LAST, |
| 862 | 'contexts' => 'backend', |
| 863 | 'inline' => true, |
| 864 | ] |
| 865 | ); |
| 866 | |
| 867 | // Register the jQuery script |
| 868 | $min = Config::getVar('general', 'enable_minified') ? '.min' : ''; |
| 869 | $this->addJavaScript( |
| 870 | 'jquery', |
| 871 | $request->getBaseUrl() . '/js/build/jquery/jquery' . $min . '.js', |
| 872 | [ |
| 873 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 874 | 'contexts' => 'backend', |
| 875 | ] |
| 876 | ); |
| 877 | $this->addJavaScript( |
| 878 | 'jqueryUI', |
| 879 | $request->getBaseUrl() . '/js/build/jquery-ui/jquery-ui' . $min . '.js', |
| 880 | [ |
| 881 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 882 | 'contexts' => 'backend', |
| 883 | ] |
| 884 | ); |
| 885 | |
| 886 | // Register the pkp-lib JS library |
| 887 | $this->registerJSLibraryData(); |
| 888 | $this->registerJSLibrary(); |
| 889 | |
| 890 | // FontAwesome - http://fontawesome.io/ |
| 891 | $this->addStyleSheet( |
| 892 | 'fontAwesome', |
| 893 | $request->getBaseUrl() . '/lib/pkp/styles/fontawesome/fontawesome.css', |
| 894 | [ |
| 895 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 896 | 'contexts' => 'backend', |
| 897 | ] |
| 898 | ); |
| 899 | |
| 900 | // Stylesheet compiled from Vue.js single-file components |
| 901 | $this->addStyleSheet( |
| 902 | 'build', |
| 903 | $request->getBaseUrl() . '/styles/build.css', |
| 904 | [ |
| 905 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 906 | 'contexts' => 'backend', |
| 907 | ] |
| 908 | ); |
| 909 | |
| 910 | // The legacy stylesheet for the backend |
| 911 | $this->addStyleSheet( |
| 912 | 'pkpLib', |
| 913 | $dispatcher->url($request, PKPApplication::ROUTE_COMPONENT, null, 'page.PageHandler', 'css'), |
| 914 | [ |
| 915 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 916 | 'contexts' => 'backend', |
| 917 | ] |
| 918 | ); |
| 919 | |
| 920 | // Set up required state properties |
| 921 | $this->setState([ |
| 922 | 'menu' => [], |
| 923 | 'tinyMCE' => [ |
| 924 | 'skinUrl' => $this->getTinyMceSkinUrl($request), |
| 925 | ], |
| 926 | ]); |
| 927 | |
| 928 | /** |
| 929 | * Kludge to make sure no code that tries to connect to the |
| 930 | * database is executed (e.g., when loading installer pages). |
| 931 | */ |
| 932 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 933 | if ($request->getUser()) { |
| 934 | // Get a count of unread tasks |
| 935 | $unreadTasksCount = Notification::withUserId($request->getUser()->getId()) |
| 936 | ->withLevel(Notification::NOTIFICATION_LEVEL_TASK) |
| 937 | ->withRead(false) |
| 938 | ->count(); |
| 939 | |
| 940 | // Get a URL to load the tasks grid |
| 941 | $tasksUrl = $request->getDispatcher()->url($request, PKPApplication::ROUTE_COMPONENT, null, 'page.PageHandler', 'tasks'); |
| 942 | |
| 943 | // Load system notifications in SiteHandler.js |
| 944 | $notificationsCount = Notification::withUserId($request->getUser()->getId()) |
| 945 | ->withLevel(Notification::NOTIFICATION_LEVEL_TRIVIAL) |
| 946 | ->count(); |
| 947 | |
| 948 | // Load context switcher |
| 949 | $isAdmin = in_array(Role::ROLE_ID_SITE_ADMIN, $this->getTemplateVars('userRoles')); |
| 950 | if ($isAdmin) { |
| 951 | $args = []; |
| 952 | } else { |
| 953 | $args = ['userId' => $request->getUser()->getId()]; |
| 954 | } |
| 955 | $availableContexts = app()->get('context')->getManySummary($args); |
| 956 | if ($request->getContext()) { |
| 957 | $availableContexts = array_filter($availableContexts, function ($context) use ($request) { |
| 958 | return $context->id !== $request->getContext()->getId(); |
| 959 | }); |
| 960 | } |
| 961 | // Admins should switch to the same page on another context where possible |
| 962 | $requestedOp = $request->getRequestedOp() === 'index' ? null : $request->getRequestedOp(); |
| 963 | $isSwitchable = $isAdmin && in_array($request->getRequestedPage(), [ |
| 964 | 'submissions', |
| 965 | 'manageIssues', |
| 966 | 'management', |
| 967 | 'payment', |
| 968 | 'stats', |
| 969 | ]); |
| 970 | foreach ($availableContexts as $availableContext) { |
| 971 | // Site admins redirected to the same page. Everyone else to submission lists |
| 972 | if ($isSwitchable) { |
| 973 | $availableContext->url = $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $availableContext->urlPath, $request->getRequestedPage(), $requestedOp, $request->getRequestedArgs()); |
| 974 | } else { |
| 975 | $availableContext->url = $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $availableContext->urlPath, 'submissions'); |
| 976 | } |
| 977 | } |
| 978 | |
| 979 | // Create main navigation menu |
| 980 | $userRoles = (array) $router->getHandler()->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_ROLES); |
| 981 | |
| 982 | $menu = []; |
| 983 | |
| 984 | if ($request->getContext()) { |
| 985 | if (count(array_intersect([Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_REVIEWER, Role::ROLE_ID_AUTHOR], $userRoles))) { |
| 986 | if(Config::getVar('features', 'enable_new_submission_listing')) { |
| 987 | if (count(array_intersect([Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT], $userRoles))) { |
| 988 | $menu['dashboards'] = [ |
| 989 | 'name' => __('navigation.dashboards'), |
| 990 | 'url' => $router->url($request, null, 'dashboard', 'editorial'), |
| 991 | 'isCurrent' => $router->getRequestedPage($request) === 'dashboards', |
| 992 | ]; |
| 993 | } |
| 994 | if(count(array_intersect([ Role::ROLE_ID_REVIEWER], $userRoles))) { |
| 995 | $menu['reviewAssignments'] = [ |
| 996 | 'name' => __('navigation.reviewAssignments'), |
| 997 | 'url' => $router->url($request, null, 'dashboard', 'reviewAssignments'), |
| 998 | 'isCurrent' => $router->getRequestedPage($request) === 'reviewAssignments', |
| 999 | ]; |
| 1000 | } |
| 1001 | if(count(array_intersect([ Role::ROLE_ID_AUTHOR], $userRoles))) { |
| 1002 | $menu['mySubmissions'] = [ |
| 1003 | 'name' => __('navigation.mySubmissions'), |
| 1004 | 'url' => $router->url($request, null, 'dashboard', 'mySubmissions'), |
| 1005 | 'isCurrent' => $router->getRequestedPage($request) === 'mySubmissions', |
| 1006 | ]; |
| 1007 | } |
| 1008 | } else { |
| 1009 | $menu['submissions'] = [ |
| 1010 | 'name' => __('navigation.submissions'), |
| 1011 | 'url' => $router->url($request, null, 'submissions'), |
| 1012 | 'isCurrent' => $router->getRequestedPage($request) === 'submissions', |
| 1013 | ]; |
| 1014 | |
| 1015 | } |
| 1016 | } elseif (count($userRoles) === 1 && in_array(Role::ROLE_ID_READER, $userRoles)) { |
| 1017 | $menu['submit'] = [ |
| 1018 | 'name' => __('author.submit'), |
| 1019 | 'url' => $router->url($request, null, 'submission'), |
| 1020 | 'isCurrent' => $router->getRequestedPage($request) === 'submission', |
| 1021 | ]; |
| 1022 | } |
| 1023 | |
| 1024 | if (count(array_intersect([Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN], $userRoles))) { |
| 1025 | if ($request->getContext()->getData('enableAnnouncements')) { |
| 1026 | $menu['announcements'] = [ |
| 1027 | 'name' => __('announcement.announcements'), |
| 1028 | 'url' => $router->url($request, null, 'management', 'settings', ['announcements']), |
| 1029 | 'isCurrent' => $router->getRequestedPage($request) === 'management' && in_array('announcements', (array) $router->getRequestedArgs($request)), |
| 1030 | ]; |
| 1031 | } |
| 1032 | |
| 1033 | if ($request->getContext()->getData(Context::SETTING_ENABLE_DOIS) && !empty($request->getContext()->getData(Context::SETTING_ENABLED_DOI_TYPES))) { |
| 1034 | $menu['dois'] = [ |
| 1035 | 'name' => __('doi.manager.displayName'), |
| 1036 | 'url' => $router->url($request, null, 'dois'), |
| 1037 | 'isCurrent' => $request->getRequestedPage() === 'dois', |
| 1038 | ]; |
| 1039 | } |
| 1040 | |
| 1041 | if ($request->getContext()->isInstitutionStatsEnabled($request->getSite())) { |
| 1042 | $menu['institutions'] = [ |
| 1043 | 'name' => __('institution.institutions'), |
| 1044 | 'url' => $router->url($request, null, 'management', 'settings', ['institutions']), |
| 1045 | 'isCurrent' => $request->getRequestedPage() === 'management' && in_array('institutions', (array) $request->getRequestedArgs()), |
| 1046 | ]; |
| 1047 | } |
| 1048 | $menu['settings'] = [ |
| 1049 | 'name' => __('navigation.settings'), |
| 1050 | 'submenu' => [ |
| 1051 | 'context' => [ |
| 1052 | 'name' => __('context.context'), |
| 1053 | 'url' => $router->url($request, null, 'management', 'settings', ['context']), |
| 1054 | 'isCurrent' => $router->getRequestedPage($request) === 'management' && in_array('context', (array) $router->getRequestedArgs($request)), |
| 1055 | ], |
| 1056 | 'website' => [ |
| 1057 | 'name' => __('manager.website'), |
| 1058 | 'url' => $router->url($request, null, 'management', 'settings', ['website']), |
| 1059 | 'isCurrent' => $router->getRequestedPage($request) === 'management' && in_array('website', (array) $router->getRequestedArgs($request)), |
| 1060 | ], |
| 1061 | 'workflow' => [ |
| 1062 | 'name' => __('manager.workflow'), |
| 1063 | 'url' => $router->url($request, null, 'management', 'settings', ['workflow']), |
| 1064 | 'isCurrent' => $router->getRequestedPage($request) === 'management' && in_array('workflow', (array) $router->getRequestedArgs($request)), |
| 1065 | ], |
| 1066 | 'distribution' => [ |
| 1067 | 'name' => __('manager.distribution'), |
| 1068 | 'url' => $router->url($request, null, 'management', 'settings', ['distribution']), |
| 1069 | 'isCurrent' => $router->getRequestedPage($request) === 'management' && in_array('distribution', (array) $router->getRequestedArgs($request)), |
| 1070 | ], |
| 1071 | 'access' => [ |
| 1072 | 'name' => __('navigation.access'), |
| 1073 | 'url' => $router->url($request, null, 'management', 'settings', ['access']), |
| 1074 | 'isCurrent' => $router->getRequestedPage($request) === 'management' && in_array('access', (array) $router->getRequestedArgs($request)), |
| 1075 | ] |
| 1076 | ] |
| 1077 | ]; |
| 1078 | } |
| 1079 | |
| 1080 | if (count(array_intersect([Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_SUB_EDITOR], $userRoles))) { |
| 1081 | $menu['statistics'] = [ |
| 1082 | 'name' => __('navigation.tools.statistics'), |
| 1083 | 'submenu' => [ |
| 1084 | 'publications' => [ |
| 1085 | 'name' => __('common.publications'), |
| 1086 | 'url' => $router->url($request, null, 'stats', 'publications', ['publications']), |
| 1087 | 'isCurrent' => $router->getRequestedPage($request) === 'stats' && $router->getRequestedOp($request) === 'publications', |
| 1088 | ], |
| 1089 | 'context' => [ |
| 1090 | 'name' => __('context.context'), |
| 1091 | 'url' => $router->url($request, null, 'stats', 'context', ['context']), |
| 1092 | 'isCurrent' => $router->getRequestedPage($request) === 'stats' && $router->getRequestedOp($request) === 'context', |
| 1093 | ], |
| 1094 | 'editorial' => [ |
| 1095 | 'name' => __('stats.editorialActivity'), |
| 1096 | 'url' => $router->url($request, null, 'stats', 'editorial', ['editorial']), |
| 1097 | 'isCurrent' => $router->getRequestedPage($request) === 'stats' && $router->getRequestedOp($request) === 'editorial', |
| 1098 | ], |
| 1099 | 'users' => [ |
| 1100 | 'name' => __('manager.users'), |
| 1101 | 'url' => $router->url($request, null, 'stats', 'users', ['users']), |
| 1102 | 'isCurrent' => $router->getRequestedPage($request) === 'stats' && $router->getRequestedOp($request) === 'users', |
| 1103 | ] |
| 1104 | ] |
| 1105 | ]; |
| 1106 | if (count(array_intersect([Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN], $userRoles))) { |
| 1107 | $menu['statistics']['submenu'] += [ |
| 1108 | 'reports' => [ |
| 1109 | 'name' => __('manager.statistics.reports'), |
| 1110 | 'url' => $router->url($request, null, 'stats', 'reports'), |
| 1111 | 'isCurrent' => $router->getRequestedPage($request) === 'stats' && $router->getRequestedOp($request) === 'reports', |
| 1112 | ] |
| 1113 | ]; |
| 1114 | } |
| 1115 | } |
| 1116 | |
| 1117 | if (count(array_intersect([Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN], $userRoles))) { |
| 1118 | $menu['tools'] = [ |
| 1119 | 'name' => __('navigation.tools'), |
| 1120 | 'url' => $router->url($request, null, 'management', 'tools'), |
| 1121 | 'isCurrent' => $router->getRequestedPage($request) === 'management' && $router->getRequestedOp($request) === 'tools', |
| 1122 | ]; |
| 1123 | } |
| 1124 | |
| 1125 | if (in_array(Role::ROLE_ID_SITE_ADMIN, $userRoles)) { |
| 1126 | $menu['admin'] = [ |
| 1127 | 'name' => __('navigation.admin'), |
| 1128 | 'url' => $router->url($request, Application::SITE_CONTEXT_PATH, 'admin'), |
| 1129 | 'isCurrent' => $router->getRequestedPage($request) === 'admin', |
| 1130 | ]; |
| 1131 | } |
| 1132 | } |
| 1133 | |
| 1134 | $this->setState([ |
| 1135 | 'menu' => $menu, |
| 1136 | 'tasksUrl' => $tasksUrl, |
| 1137 | 'unreadTasksCount' => $unreadTasksCount, |
| 1138 | ]); |
| 1139 | |
| 1140 | $this->assign([ |
| 1141 | 'availableContexts' => $availableContexts, |
| 1142 | 'hasSystemNotifications' => $notificationsCount > 0, |
| 1143 | ]); |
| 1144 | } |
| 1145 | } |
| 1146 | |
| 1147 | Hook::call('TemplateManager::setupBackendPage'); |
| 1148 | } |
| 1149 | |
| 1150 | /** |
| 1151 | * @copydoc Smarty::fetch() |
| 1152 | * |
| 1153 | * @param null|mixed $template |
| 1154 | * @param null|mixed $cache_id |
| 1155 | * @param null|mixed $compile_id |
| 1156 | * @param null|mixed $parent |
| 1157 | * |
| 1158 | * @hook TemplateManager::fetch [[$this, $template, $cache_id, $compile_id, &$result]] |
| 1159 | */ |
| 1160 | public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1161 | { |
| 1162 | // If no compile ID was assigned, get one. |
| 1163 | if (!$compile_id) { |
| 1164 | $compile_id = $this->getCompileId($template); |
| 1165 | } |
| 1166 | |
| 1167 | // Give hooks an opportunity to override |
| 1168 | $result = null; |
| 1169 | if (Hook::call('TemplateManager::fetch', [$this, $template, $cache_id, $compile_id, &$result])) { |
| 1170 | return $result; |
| 1171 | } |
| 1172 | |
| 1173 | return parent::fetch($template, $cache_id, $compile_id, $parent); |
| 1174 | } |
| 1175 | |
| 1176 | /** |
| 1177 | * Fetch content via AJAX and add it to the DOM, wrapped in a container element. |
| 1178 | * |
| 1179 | * @param string $id ID to use for the generated container element. |
| 1180 | * @param string $url URL to fetch the contents from. |
| 1181 | * @param string $element Element to use for container. |
| 1182 | */ |
| 1183 | public function fetchAjax(string $id, string $url, string $element = 'div'): JSONMessage |
| 1184 | { |
| 1185 | return new JSONMessage(true, $this->smartyLoadUrlInEl( |
| 1186 | [ |
| 1187 | 'url' => $url, |
| 1188 | 'id' => $id, |
| 1189 | 'el' => $element, |
| 1190 | ], |
| 1191 | $this |
| 1192 | )); |
| 1193 | } |
| 1194 | |
| 1195 | /** |
| 1196 | * Calculate a compile ID for a resource. |
| 1197 | */ |
| 1198 | public function getCompileId(string $resourceName): string |
| 1199 | { |
| 1200 | if (Application::isInstalled()) { |
| 1201 | $context = $this->_request->getContext(); |
| 1202 | if ($context instanceof Context) { |
| 1203 | $resourceName .= $context->getData('themePluginPath'); |
| 1204 | } |
| 1205 | } |
| 1206 | |
| 1207 | return sha1($resourceName); |
| 1208 | } |
| 1209 | |
| 1210 | /** |
| 1211 | * Returns the template results as a JSON message. |
| 1212 | * |
| 1213 | * @param string $template Template filename (or Smarty resource name) |
| 1214 | */ |
| 1215 | public function fetchJson(string $template, bool $status = true): JSONMessage |
| 1216 | { |
| 1217 | return new JSONMessage($status, $this->fetch($template)); |
| 1218 | } |
| 1219 | |
| 1220 | /** |
| 1221 | * @copydoc Smarty::display() |
| 1222 | * |
| 1223 | * @param null|mixed $template |
| 1224 | * @param null|mixed $cache_id |
| 1225 | * @param null|mixed $compile_id |
| 1226 | * @param null|mixed $parent |
| 1227 | * |
| 1228 | * @hook TemplateManager::display [[$this, &$template, &$output]] |
| 1229 | */ |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1290 | echo $output; |
| 1291 | return; |
| 1292 | } |
| 1293 | |
| 1294 | // Pass the initial state data for this page |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1319 | |
| 1320 | /** |
| 1321 | * Clear template compile and cache directories. |
| 1322 | */ |
| 1323 | public function clearTemplateCache() |
| 1324 | { |
| 1325 | $this->clearCompiledTemplate(); |
| 1326 | $this->clearAllCache(); |
| 1327 | } |
| 1328 | |
| 1329 | /** |
| 1330 | * Clear all compiled CSS files |
| 1331 | */ |
| 1332 | public function clearCssCache() |
| 1333 | { |
| 1334 | $cacheDirectory = Core::getBaseDir() . '/cache'; |
| 1335 | array_map('unlink', glob($cacheDirectory . '/*.' . self::CSS_FILENAME_SUFFIX)); |
| 1336 | } |
| 1337 | |
| 1338 | /** |
| 1339 | * Clear the cache when a context or site has changed it's active theme |
| 1340 | * |
| 1341 | * @param string $hookName |
| 1342 | * @param array $args [ |
| 1343 | * |
| 1344 | * @option Context|Site The new values |
| 1345 | * @option Context|Site The old values |
| 1346 | * @option array Key/value of params that were modified |
| 1347 | * @option Request |
| 1348 | * ] |
| 1349 | */ |
| 1350 | public function clearThemeTemplateCache($hookName, $args) |
| 1351 | { |
| 1352 | $newContextOrSite = $args[0]; |
| 1353 | $contextOrSite = $args[1]; |
| 1354 | if ($newContextOrSite->getData('themePluginPath') !== $contextOrSite->getData('themePluginPath')) { |
| 1355 | $this->clearTemplateCache(); |
| 1356 | $this->clearCssCache(); |
| 1357 | } |
| 1358 | } |
| 1359 | |
| 1360 | /** |
| 1361 | * Return an instance of the template manager. |
| 1362 | */ |
| 1363 | public static function &getManager(?PKPRequest $request = null): TemplateManager |
| 1364 | { |
| 1365 | if (!isset($request)) { |
| 1366 | $request = Registry::get('request'); |
| 1367 | if (Config::getVar('debug', 'deprecation_warnings')) { |
| 1368 | throw new Exception('Deprecated call without request object.'); |
| 1369 | } |
| 1370 | } |
| 1371 | $instance = &Registry::get('templateManager', true, null); // Reference required |
| 1372 | |
| 1373 | if ($instance === null) { |
| 1374 | $instance = new TemplateManager(); |
| 1375 | $themes = PluginRegistry::getPlugins('themes'); |
| 1376 | if (empty($themes)) { |
| 1377 | $themes = PluginRegistry::loadCategory('themes', true); |
| 1378 | } |
| 1379 | $instance->initialize($request); |
| 1380 | } |
| 1381 | |
| 1382 | return $instance; |
| 1383 | } |
| 1384 | |
| 1385 | /** |
| 1386 | * Return an instance of the Form Builder Vocabulary class. |
| 1387 | */ |
| 1388 | public function getFBV(): FormBuilderVocabulary |
| 1389 | { |
| 1390 | if (!isset($this->_fbv)) { |
| 1391 | $this->_fbv = new FormBuilderVocabulary(); |
| 1392 | } |
| 1393 | return $this->_fbv; |
| 1394 | } |
| 1395 | |
| 1396 | /** |
| 1397 | * Display the sidebar |
| 1398 | * |
| 1399 | * @param array $args [ |
| 1400 | * |
| 1401 | * @option array Params passed to the hook |
| 1402 | * @option Smarty |
| 1403 | * @option string The output |
| 1404 | * ] |
| 1405 | */ |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1413 | $blocks = $this->_request->getContext()->getData('sidebar'); |
| 1414 | } else { |
| 1415 | $blocks = $this->_request->getSite()->getData('sidebar'); |
| 1416 | } |
| 1417 | |
| 1418 | if (empty($blocks)) { |
| 1419 | return false; |
| 1420 | } |
| 1421 | |
| 1422 | $plugins = PluginRegistry::loadCategory('blocks', true); |
| 1423 | if (empty($plugins)) { |
| 1424 | return false; |
| 1425 | } |
| 1426 | |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1429 | $output .= $plugins[$pluginName]->getContents($smarty, $this->_request); |
| 1430 | } |
| 1431 | } |
| 1432 | |
| 1433 | return false; |
| 1434 | } |
| 1435 | |
| 1436 | /** |
| 1437 | * Get the URL to the TinyMCE skin |
| 1438 | */ |
| 1439 | public function getTinyMceSkinUrl(Request $request): string |
| 1440 | { |
| 1441 | return $request->getBaseUrl() . '/lib/pkp/styles/tinymce'; |
| 1442 | } |
| 1443 | |
| 1444 | |
| 1445 | // |
| 1446 | // Custom template functions, modifiers, etc. |
| 1447 | // |
| 1448 | |
| 1449 | /** |
| 1450 | * Smarty usage: |
| 1451 | * Simple translation |
| 1452 | * {translate key="localization.key.name" [paramName="paramValue" ...]} |
| 1453 | * |
| 1454 | * Pluralized translation |
| 1455 | * {translate key="localization.key.name" count="10" [paramName="paramValue" ...]} |
| 1456 | * Custom Smarty function for translating localization keys. |
| 1457 | * Substitution works by replacing tokens like "{$foo}" with the value of the parameter named "foo" (if supplied). |
| 1458 | * |
| 1459 | * The params named "key", "count", "locale" and "params" are reserved. If you need to pass one of them as a translation variable specify them using the "params": |
| 1460 | * $smarty->assign('params', ['key' => "Golden key"]); |
| 1461 | * {translate key="pluralized.key" locale="en" count="10" params=$params} |
| 1462 | * |
| 1463 | * @param array $params associative array, must contain "key" parameter for string to translate plus zero or more named parameters for substitution. |
| 1464 | * Translation variables can be specified also as an optional associative array named "params". |
| 1465 | * |
| 1466 | * @return string the localized string, including any parameter substitutions |
| 1467 | */ |
| 1468 | public function smartyTranslate(array $params, Smarty_Internal_Template $smarty): string |
| 1469 | { |
| 1470 | // Save reserved params before removing them |
| 1471 | $key = $params['key'] ?? ''; |
| 1472 | $count = $params['count'] ?? null; |
| 1473 | $locale = $params['locale'] ?? null; |
| 1474 | $variables = $params['params'] ?? []; |
| 1475 | // Remove reserved params |
| 1476 | unset($params['key'], $params['count'], $params['params'], $params['locale']); |
| 1477 | // Merge variables |
| 1478 | $variables = $params + $variables; |
| 1479 | // Decides between the simple/pluralized version |
| 1480 | return $count === null ? __($key, $variables, $locale) : __p($key, $count, $variables, $locale); |
| 1481 | } |
| 1482 | |
| 1483 | /** |
| 1484 | * Smarty usage: {help file="someFile" section="someSection" textKey="some.text.key"} |
| 1485 | * |
| 1486 | * Custom Smarty function for displaying a context-sensitive help link. |
| 1487 | * |
| 1488 | * @param Smarty $smarty |
| 1489 | * |
| 1490 | * @return string the HTML for the generated link action |
| 1491 | */ |
| 1492 | public function smartyHelp($params, $smarty) |
| 1493 | { |
| 1494 | assert(isset($params['file'])); |
| 1495 | |
| 1496 | $params = array_merge( |
| 1497 | [ |
| 1498 | 'file' => null, // The name of the Markdown file |
| 1499 | 'section' => null, // The (optional) anchor within the Markdown file |
| 1500 | 'textKey' => 'help.help', // An (optional) locale key for the link |
| 1501 | 'text' => null, // An (optional) literal text for the link |
| 1502 | 'class' => null, // An (optional) CSS class string for the link |
| 1503 | ], |
| 1504 | $params |
| 1505 | ); |
| 1506 | |
| 1507 | $this->assign([ |
| 1508 | 'helpFile' => $params['file'], |
| 1509 | 'helpSection' => $params['section'], |
| 1510 | 'helpTextKey' => $params['textKey'], |
| 1511 | 'helpText' => $params['text'], |
| 1512 | 'helpClass' => $params['class'], |
| 1513 | ]); |
| 1514 | |
| 1515 | return $this->fetch('common/helpLink.tpl'); |
| 1516 | } |
| 1517 | |
| 1518 | /** |
| 1519 | * Smarty usage: {html_options_translate ...} |
| 1520 | * For parameter usage, see http://smarty.php.net/manual/en/language.function.html.options.php |
| 1521 | * |
| 1522 | * Identical to Smarty's "html_options" function except option values are translated from i18n keys. |
| 1523 | * |
| 1524 | * @param array $params |
| 1525 | * @param Smarty $smarty |
| 1526 | */ |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1534 | $newOptions[__($k)] = __($v); |
| 1535 | } |
| 1536 | $params['options'] = $newOptions; |
| 1537 | } else { |
| 1538 | // Just translate output |
| 1539 | $params['options'] = array_map('__', $params['options']); |
| 1540 | } |
| 1541 | } |
| 1542 | |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1555 | |
| 1556 | /** |
| 1557 | * Iterator function for looping through objects extending the |
| 1558 | * ItemIterator class. |
| 1559 | * Parameters: |
| 1560 | * - from: Name of template variable containing iterator |
| 1561 | * - item: Name of template variable to receive each item |
| 1562 | * - key: (optional) Name of variable to receive index of current item |
| 1563 | */ |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1570 | $smarty->assign($params['key'], 1); |
| 1571 | } else { |
| 1572 | $smarty->assign($params['key'], $smarty->getTemplateVars($params['key']) + 1); |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | // If the iterator is empty, we're finished. |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1579 | return $content; |
| 1580 | } |
| 1581 | $repeat = false; |
| 1582 | return ''; |
| 1583 | } |
| 1584 | |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1588 | [$key, $value] = $iterator->nextWithKey(); |
| 1589 | $smarty->assign([ |
| 1590 | $params['item'] => $value, |
| 1591 | $params['key'] => $key |
| 1592 | ]); |
| 1593 | } else { |
| 1594 | $smarty->assign($params['item'], $iterator->next()); |
| 1595 | } |
| 1596 | return $content; |
| 1597 | } |
| 1598 | |
| 1599 | /** |
| 1600 | * Display page information for a listing of items that has been |
| 1601 | * divided onto multiple pages. |
| 1602 | * Usage: |
| 1603 | * {page_info from=$myIterator} |
| 1604 | */ |
| 1605 | public function smartyPageInfo($params, $smarty) |
| 1606 | { |
| 1607 | $iterator = $params['iterator']; |
| 1608 | |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1610 | $itemsPerPage = $params['itemsPerPage']; |
| 1611 | } else { |
| 1612 | $itemsPerPage = $smarty->getTemplateVars('itemsPerPage'); |
| 1613 | if (!is_numeric($itemsPerPage)) { |
| 1614 | $itemsPerPage = 25; |
| 1615 | } |
| 1616 | } |
| 1617 | |
| 1618 | $page = $iterator->getPage(); |
| 1619 | $pageCount = $iterator->getPageCount(); |
| 1620 | $itemTotal = $iterator->getCount(); |
| 1621 | |
| 1622 | if ($pageCount < 1) { |
| 1623 | return ''; |
| 1624 | } |
| 1625 | |
| 1626 | $from = (($page - 1) * $itemsPerPage) + 1; |
| 1627 | $to = min($itemTotal, $page * $itemsPerPage); |
| 1628 | |
| 1629 | return __('navigation.items', [ |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1631 | 'to' => $to, |
| 1632 | 'total' => $itemTotal |
| 1633 | ]); |
| 1634 | } |
| 1635 | |
| 1636 | /** |
| 1637 | * Flush the output buffer. This is useful in cases where Smarty templates |
| 1638 | * are calling functions that take a while to execute so that they can display |
| 1639 | * a progress indicator or a message stating that the operation may take a while. |
| 1640 | */ |
| 1641 | public function smartyFlush($params, $smarty) |
| 1642 | { |
| 1643 | $smarty->flush(); |
| 1644 | } |
| 1645 | |
| 1646 | public function flush() |
| 1647 | { |
| 1648 | while (ob_get_level()) { |
| 1649 | ob_end_flush(); |
| 1650 | } |
| 1651 | flush(); |
| 1652 | } |
| 1653 | |
| 1654 | /** |
| 1655 | * Call hooks from a template. (DEPRECATED: For new hooks, {run_hook} is preferred. |
| 1656 | */ |
| 1657 | public function smartyCallHook($params, $smarty) |
| 1658 | { |
| 1659 | $output = null; |
| 1660 | Hook::call($params['name'], [&$params, $smarty, &$output]); |
| 1661 | return $output; |
| 1662 | } |
| 1663 | |
| 1664 | /** |
| 1665 | * Run hooks from a template. |
| 1666 | */ |
| 1667 | public function smartyRunHook(array $params): ?string |
| 1668 | { |
| 1669 | $output = null; |
| 1670 | |
| 1671 | // Don't pollute the parameter list with a redundant hook name |
| 1672 | $hookName = $params['name']; |
| 1673 | unset($params['name']); |
| 1674 | |
| 1675 | Hook::run($hookName, ['templateMgr' => $this, 'output' => &$output, ...$params]); |
| 1676 | return $output; |
| 1677 | } |
| 1678 | |
| 1679 | /** |
| 1680 | * Generate a URL into a PKPApp. |
| 1681 | * |
| 1682 | * @param object $smarty |
| 1683 | * Available parameters: |
| 1684 | * - router: which router to use |
| 1685 | * - context |
| 1686 | * - page |
| 1687 | * - component |
| 1688 | * - op |
| 1689 | * - path (array) |
| 1690 | * - anchor |
| 1691 | * - escape (default to true unless otherwise specified) |
| 1692 | * - params: parameters to include in the URL if available as an array |
| 1693 | */ |
| 1694 | public function smartyUrl($parameters, $smarty): string |
| 1695 | { |
| 1696 | if (!isset($parameters['context'])) { |
| 1697 | // Extract the variables named in $paramList, and remove them |
| 1698 | // from the parameters array. Variables remaining in params will be |
| 1699 | // passed along to Request::url as extra parameters. |
| 1700 | $contextName = Application::get()->getContextName(); |
| 1701 | if (isset($parameters[$contextName])) { |
| 1702 | $context = $parameters[$contextName]; |
| 1703 | unset($parameters[$contextName]); |
| 1704 | } else { |
| 1705 | $context = null; |
| 1706 | } |
| 1707 | $parameters['context'] = $context; |
| 1708 | } |
| 1709 | |
| 1710 | // Extract the reserved variables named in $paramList, and remove them |
| 1711 | // from the parameters array. Variables remaining in parameters will be passed |
| 1712 | // along to Request::url as extra parameters. |
| 1713 | $params = $router = $page = $component = $anchor = $escape = $op = $path = $urlLocaleForPage = null; |
| 1714 | $paramList = ['params', 'router', 'context', 'page', 'component', 'op', 'path', 'anchor', 'escape', 'urlLocaleForPage']; |
| 1715 | foreach ($paramList as $parameter) { |
| 1716 | if (isset($parameters[$parameter])) { |
| 1717 | $$parameter = $parameters[$parameter]; |
| 1718 | } else { |
| 1719 | $$parameter = null; |
| 1720 | } |
| 1721 | unset($parameters[$parameter]); |
| 1722 | } |
| 1723 | if (is_scalar($path)) { |
| 1724 | $path = [$path]; |
| 1725 | } |
| 1726 | |
| 1727 | // Merge parameters specified in the {url paramName=paramValue} format with |
| 1728 | // those optionally supplied in {url params=$someAssociativeArray} format |
| 1729 | $parameters = array_merge($parameters, (array) $params); |
| 1730 | |
| 1731 | // Set the default router |
| 1732 | if (is_null($router)) { |
| 1733 | if ($this->_request->getRouter() instanceof \PKP\core\PKPComponentRouter) { |
| 1734 | $router = PKPApplication::ROUTE_COMPONENT; |
| 1735 | } else { |
| 1736 | $router = PKPApplication::ROUTE_PAGE; |
| 1737 | } |
| 1738 | } |
| 1739 | |
| 1740 | // Identify the handler |
| 1741 | $handler = match ($router) { |
| 1742 | PKPApplication::ROUTE_PAGE => $page, |
| 1743 | PKPApplication::ROUTE_COMPONENT => $component, |
| 1744 | }; |
| 1745 | |
| 1746 | // Let the dispatcher create the url |
| 1747 | $dispatcher = Application::get()->getDispatcher(); |
| 1748 | return $dispatcher->url($this->_request, $router, $context, $handler, $op, $path, $parameters, $anchor, !isset($escape) || $escape, $urlLocaleForPage); |
| 1749 | } |
| 1750 | |
| 1751 | /** |
| 1752 | * Generate the <title> tag for a page |
| 1753 | * |
| 1754 | * Usage: {title value="Journal Settings"} |
| 1755 | * |
| 1756 | * @param array $parameters |
| 1757 | * @param object $smarty |
| 1758 | * Available parameters: |
| 1759 | * - router: which router to use |
| 1760 | * - context |
| 1761 | * - page |
| 1762 | * - component |
| 1763 | * - op |
| 1764 | * - path (array) |
| 1765 | * - anchor |
| 1766 | * - escape (default to true unless otherwise specified) |
| 1767 | * - params: parameters to include in the URL if available as an array |
| 1768 | */ |
| 1769 | public function smartyTitle($parameters, $smarty): string |
| 1770 | { |
| 1771 | $page = $parameters['value'] ?? ''; |
| 1772 | if ($smarty->getTemplateVars('currentContext')) { |
| 1773 | $siteTitle = $smarty->getTemplateVars('currentContext')->getLocalizedData('name'); |
| 1774 | } elseif ($smarty->getTemplateVars('siteTitle')) { |
| 1775 | $siteTitle = $smarty->getTemplateVars('siteTitle'); |
| 1776 | } else { |
| 1777 | $siteTitle = __('common.software'); |
| 1778 | } |
| 1779 | |
| 1780 | if (empty($parameters['value'])) { |
| 1781 | return $siteTitle; |
| 1782 | } |
| 1783 | |
| 1784 | return $parameters['value'] . __('common.titleSeparator') . $siteTitle; |
| 1785 | } |
| 1786 | |
| 1787 | /** |
| 1788 | * Display page links for a listing of items that has been |
| 1789 | * divided onto multiple pages. |
| 1790 | * Usage: |
| 1791 | * {page_links |
| 1792 | * name="nameMustMatchGetRangeInfoCall" |
| 1793 | * iterator=$myIterator |
| 1794 | * additional_param=myAdditionalParameterValue |
| 1795 | * } |
| 1796 | */ |
| 1797 | public function smartyPageLinks($params, $smarty): string |
| 1798 | { |
| 1799 | $iterator = $params['iterator']; |
| 1800 | $name = $params['name']; |
| 1801 | if (isset($params['params']) && is_array($params['params'])) { |
| 1802 | $extraParams = $params['params']; |
| 1803 | unset($params['params']); |
| 1804 | $params = array_merge($params, $extraParams); |
| 1805 | } |
| 1806 | if (isset($params['anchor'])) { |
| 1807 | $anchor = $params['anchor']; |
| 1808 | unset($params['anchor']); |
| 1809 | } else { |
| 1810 | $anchor = null; |
| 1811 | } |
| 1812 | if (isset($params['all_extra'])) { |
| 1813 | $allExtra = ' ' . $params['all_extra']; |
| 1814 | unset($params['all_extra']); |
| 1815 | } else { |
| 1816 | $allExtra = ''; |
| 1817 | } |
| 1818 | |
| 1819 | unset($params['iterator']); |
| 1820 | unset($params['name']); |
| 1821 | |
| 1822 | $numPageLinks = $smarty->getTemplateVars('numPageLinks'); |
| 1823 | if (!is_numeric($numPageLinks)) { |
| 1824 | $numPageLinks = 10; |
| 1825 | } |
| 1826 | |
| 1827 | $page = $iterator->getPage(); |
| 1828 | $pageCount = $iterator->getPageCount(); |
| 1829 | |
| 1830 | $pageBase = max($page - floor($numPageLinks / 2), 1); |
| 1831 | $paramName = $name . 'Page'; |
| 1832 | |
| 1833 | if ($pageCount <= 1) { |
| 1834 | return ''; |
| 1835 | } |
| 1836 | |
| 1837 | $value = ''; |
| 1838 | |
| 1839 | $router = $this->_request->getRouter(); |
| 1840 | $requestedArgs = null; |
| 1841 | if ($router instanceof PageRouter) { |
| 1842 | $requestedArgs = $router->getRequestedArgs($this->_request); |
| 1843 | } |
| 1844 | |
| 1845 | if ($page > 1) { |
| 1846 | $params[$paramName] = 1; |
| 1847 | $value .= '<a href="' . $this->_request->url(null, null, null, $requestedArgs, $params, $anchor) . '"' . $allExtra . '><<</a> '; |
| 1848 | $params[$paramName] = $page - 1; |
| 1849 | $value .= '<a href="' . $this->_request->url(null, null, null, $requestedArgs, $params, $anchor) . '"' . $allExtra . '><</a> '; |
| 1850 | } |
| 1851 | |
| 1852 | for ($i = $pageBase; $i < min($pageBase + $numPageLinks, $pageCount + 1); $i++) { |
| 1853 | if ($i == $page) { |
| 1854 | $value .= "<strong>{$i}</strong> "; |
| 1855 | } else { |
| 1856 | $params[$paramName] = $i; |
| 1857 | $value .= '<a href="' . $this->_request->url(null, null, null, $requestedArgs, $params, $anchor) . '"' . $allExtra . '>' . $i . '</a> '; |
| 1858 | } |
| 1859 | } |
| 1860 | if ($page < $pageCount) { |
| 1861 | $params[$paramName] = $page + 1; |
| 1862 | $value .= '<a href="' . $this->_request->url(null, null, null, $requestedArgs, $params, $anchor) . '"' . $allExtra . '>></a> '; |
| 1863 | $params[$paramName] = $pageCount; |
| 1864 | $value .= '<a href="' . $this->_request->url(null, null, null, $requestedArgs, $params, $anchor) . '"' . $allExtra . '>>></a> '; |
| 1865 | } |
| 1866 | |
| 1867 | return $value; |
| 1868 | } |
| 1869 | |
| 1870 | /** |
| 1871 | * Compare the parameters. |
| 1872 | * |
| 1873 | * @param mixed $a Parameter A |
| 1874 | * @param mixed $a Parameter B |
| 1875 | * @param bool $strict True iff a strict (===) compare should be used |
| 1876 | * @param bool $invert True iff the output should be inverted |
| 1877 | */ |
| 1878 | public function smartyCompare($a, $b, $strict = false, $invert = false) |
| 1879 | { |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1881 | return $invert ? !$result : $result; |
| 1882 | } |
| 1883 | |
| 1884 | /** |
| 1885 | * Override the built-in smarty escape modifier to |
| 1886 | * add the jqselector escaping method. |
| 1887 | */ |
| 1888 | public function smartyEscape($string, $esc_type = 'html', $char_set = 'ISO-8859-1') |
| 1889 | { |
| 1890 | $pattern = "/(:|\.|\[|\]|,|=|@)/"; |
| 1891 | $replacement = '\\\\\\\$1'; |
| 1892 | switch ($esc_type) { |
| 1893 | // Because jQuery uses CSS syntax for selecting elements |
| 1894 | // some characters are interpreted as CSS notation. |
| 1895 | // In order to tell jQuery to treat these characters literally rather |
| 1896 | // than as CSS notation, they must be escaped by placing two backslashes |
| 1897 | // in front of them. |
| 1898 | case 'jqselector': |
| 1899 | $result = smarty_modifier_escape($string, 'html', $char_set); |
| 1900 | $result = preg_replace($pattern, $replacement, $result); |
| 1901 | return $result; |
| 1902 | |
| 1903 | case 'jsid': |
| 1904 | $result = smarty_modifier_escape($string, 'javascript', $char_set); |
| 1905 | $result = preg_replace($pattern, $replacement, $result); |
| 1906 | return $result; |
| 1907 | |
| 1908 | default: |
| 1909 | return smarty_modifier_escape($string, $esc_type, $char_set); |
| 1910 | } |
| 1911 | } |
| 1912 | |
| 1913 | /** |
| 1914 | * Smarty usage: {load_url_in_el el="htmlElement" id="someHtmlId" url="http://the.url.to.be.loaded.into.the.grid"} |
| 1915 | * |
| 1916 | * Custom Smarty function for loading a URL via AJAX into any HTML element |
| 1917 | * |
| 1918 | * @param array $params associative array |
| 1919 | * @param Smarty $smarty |
| 1920 | * |
| 1921 | * @return string of HTML/Javascript |
| 1922 | */ |
| 1923 | public function smartyLoadUrlInEl($params, $smarty) |
| 1924 | { |
| 1925 | // Required Params |
| 1926 | if (!isset($params['el'])) { |
| 1927 | throw new Exception('el parameter is missing from load_url_in_el'); |
| 1928 | } |
| 1929 | if (!isset($params['url'])) { |
| 1930 | throw new Exception('url parameter is missing from load_url_in_el'); |
| 1931 | } |
| 1932 | if (!isset($params['id'])) { |
| 1933 | throw new Exception('id parameter is missing from load_url_in_el'); |
| 1934 | } |
| 1935 | |
| 1936 | $this->assign([ |
| 1937 | 'inEl' => $params['el'], |
| 1938 | 'inElUrl' => $params['url'], |
| 1939 | 'inElElId' => $params['id'], |
| 1940 | 'inElClass' => $params['class'] ?? null, |
| 1941 | 'inVueEl' => $params['inVueEl'] ?? null, |
| 1942 | 'refreshOn' => $params['refreshOn'] ?? null, |
| 1943 | ]); |
| 1944 | |
| 1945 | if (isset($params['placeholder'])) { |
| 1946 | $this->assign('inElPlaceholder', $params['placeholder']); |
| 1947 | } elseif (isset($params['loadMessageId'])) { |
| 1948 | $loadMessageId = $params['loadMessageId']; |
| 1949 | $this->assign('inElPlaceholder', __($loadMessageId, $params)); |
| 1950 | } else { |
| 1951 | $this->assign('inElPlaceholder', $this->fetch('common/loadingContainer.tpl')); |
| 1952 | } |
| 1953 | |
| 1954 | return $this->fetch('common/urlInEl.tpl'); |
| 1955 | } |
| 1956 | |
| 1957 | /** |
| 1958 | * Smarty usage: {load_url_in_div id="someHtmlId" url="http://the.url.to.be.loaded.into.the.grid"} |
| 1959 | * |
| 1960 | * Custom Smarty function for loading a URL via AJAX into a DIV. Convenience |
| 1961 | * wrapper for smartyLoadUrlInEl. |
| 1962 | * |
| 1963 | * @param array $params associative array |
| 1964 | * @param Smarty $smarty |
| 1965 | * |
| 1966 | * @return string of HTML/Javascript |
| 1967 | */ |
| 1968 | public function smartyLoadUrlInDiv($params, $smarty) |
| 1969 | { |
| 1970 | $params['el'] = 'div'; |
| 1971 | return $this->smartyLoadUrlInEl($params, $smarty); |
| 1972 | } |
| 1973 | |
| 1974 | /** |
| 1975 | * Smarty usage: {csrf} |
| 1976 | * |
| 1977 | * Custom Smarty function for inserting a CSRF token. |
| 1978 | * |
| 1979 | * @param array $params associative array |
| 1980 | * @param Smarty $smarty |
| 1981 | * |
| 1982 | * @return string of HTML |
| 1983 | */ |
| 1984 | public function smartyCSRF($params, $smarty) |
| 1985 | { |
| 1986 | $csrfToken = $this->_request->getSession()->token(); |
| 1987 | switch ($params['type'] ?? null) { |
| 1988 | case 'raw': return $csrfToken; |
| 1989 | case 'json': return json_encode($csrfToken); |
| 1990 | case 'html': |
| 1991 | default: |
| 1992 | return '<input type="hidden" name="csrfToken" value="' . htmlspecialchars($csrfToken) . '">'; |
| 1993 | } |
| 1994 | } |
| 1995 | |
| 1996 | /** |
| 1997 | * Smarty usage: {load_stylesheet context="frontend" stylesheets=$stylesheets} |
| 1998 | * |
| 1999 | * Custom Smarty function for printing stylesheets attached to a context. |
| 2000 | * |
| 2001 | * @param array $params associative array |
| 2002 | * @param Smarty $smarty |
| 2003 | * |
| 2004 | * @return string of HTML/Javascript |
| 2005 | */ |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2014 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2015 | } else { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2039 | |
| 2040 | /** |
| 2041 | * Inject default styles into a HTML galley |
| 2042 | * |
| 2043 | * Any styles assigned to the `htmlGalley` context will be injected into the |
| 2044 | * galley unless the galley already has an embedded CSS file. |
| 2045 | * |
| 2046 | * @param string $htmlContent The HTML file content |
| 2047 | * @param array $embeddedFiles Additional files embedded in this galley |
| 2048 | */ |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2052 | return $htmlContent; |
| 2053 | } |
| 2054 | |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2064 | return $htmlContent; |
| 2065 | } |
| 2066 | |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2085 | |
| 2086 | /** |
| 2087 | * Smarty usage: {load_script context="backend" scripts=$scripts} |
| 2088 | * |
| 2089 | * Custom Smarty function for printing scripts attached to a context. |
| 2090 | * |
| 2091 | * @param array $params associative array |
| 2092 | * @param Smarty $smarty |
| 2093 | * |
| 2094 | * @return string of HTML/Javascript |
| 2095 | */ |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2104 | } else { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2128 | |
| 2129 | /** |
| 2130 | * Smarty usage: {load_header context="frontend" headers=$headers} |
| 2131 | * |
| 2132 | * Custom Smarty function for printing scripts attached to a context. |
| 2133 | * |
| 2134 | * @param array $params associative array |
| 2135 | * @param Smarty $smarty |
| 2136 | * |
| 2137 | * @return string of HTML/Javascript |
| 2138 | */ |
| 2139 | public function smartyLoadHeader($params, $smarty) |
| 2140 | { |
| 2141 | if (empty($params['context'])) { |
| 2142 | $params['context'] = 'frontend'; |
| 2143 | } |
| 2144 | |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2146 | |
| 2147 | ksort($headers); |
| 2148 | |
| 2149 | $output = ''; |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2152 | $output .= "\n" . $data['header']; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | return $output; |
| 2157 | } |
| 2158 | |
| 2159 | /** |
| 2160 | * Smarty usage: {load_menu name=$areaName path=$declaredMenuTemplatePath id=$id ulClass=$ulClass liClass=$liClass} |
| 2161 | * |
| 2162 | * Custom Smarty function for printing navigation menu areas attached to a context. |
| 2163 | * |
| 2164 | * @param array $params associative array |
| 2165 | * @param Smarty $smarty |
| 2166 | * |
| 2167 | * @return string of HTML/Javascript |
| 2168 | */ |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2219 | |
| 2220 | /** |
| 2221 | * Get resources assigned to a context |
| 2222 | * |
| 2223 | * A helper function which retrieves script, style and header assets |
| 2224 | * assigned to a particular context. |
| 2225 | * |
| 2226 | * @param array $resources Requested resources |
| 2227 | * @param string $context Requested context |
| 2228 | * |
| 2229 | * @return array Resources assigned to these contexts |
| 2230 | */ |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2263 | |
| 2264 | /** |
| 2265 | * Smarty usage: {pluck_files files=$availableFiles by="chapter" value=$chapterId} |
| 2266 | * |
| 2267 | * Custom Smarty function for plucking files from the array of $availableFiles |
| 2268 | * related to a submission. Intended to be used on the frontend |
| 2269 | * |
| 2270 | * @param array $params associative array |
| 2271 | * @param Smarty $smarty |
| 2272 | */ |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2277 | error_log('Smarty: {pluck_files} function called without required `assign` param. Called in ' . __FILE__ . ':' . __LINE__); |
| 2278 | return; |
| 2279 | } |
| 2280 | |
| 2281 | // $params['files'] should be an array of SubmissionFile objects |
| 2282 | if (!is_array($params['files'])) { |
| 2283 | error_log('Smarty: {pluck_files} function called without required `files` param. Called in ' . __FILE__ . ':' . __LINE__); |
| 2284 | $smarty->assign($params['assign'], []); |
| 2285 | return; |
| 2286 | } |
| 2287 | |
| 2288 | // $params['by'] is one of an approved list of attributes to select by |
| 2289 | if (empty($params['by'])) { |
| 2290 | error_log('Smarty: {pluck_files} function called without required `by` param. Called in ' . __FILE__ . ':' . __LINE__); |
| 2291 | $smarty->assign($params['assign'], []); |
| 2292 | return; |
| 2293 | } |
| 2294 | |
| 2295 | // The approved list of `by` attributes |
| 2296 | // chapter Any files assigned to a chapter ID. A value of `any` will return files assigned to any chapter. A value of 0 will return files not assigned to chapter |
| 2297 | // publicationFormat Any files in a given publicationFormat ID |
| 2298 | // genre Any files with a genre ID (file genres are configurable but typically refer to Manuscript, Bibliography, etc) |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2300 | error_log('Smarty: {pluck_files} function called without a valid `by` param. Called in ' . __FILE__ . ':' . __LINE__); |
| 2301 | $smarty->assign($params['assign'], []); |
| 2302 | return; |
| 2303 | } |
| 2304 | |
| 2305 | // The value to match against. See docs for `by` param |
| 2306 | if (!isset($params['value'])) { |
| 2307 | error_log('Smarty: {pluck_files} function called without required `value` param. Called in ' . __FILE__ . ':' . __LINE__); |
| 2308 | $smarty->assign($params['assign'], []); |
| 2309 | return; |
| 2310 | } |
| 2311 | |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2346 | |
| 2347 | /** |
| 2348 | * Get the direction of a locale |
| 2349 | * |
| 2350 | * @param array $params |
| 2351 | * @param TemplateManager $smarty |
| 2352 | */ |
| 2353 | public function smartyLocaleDirection($params, $smarty) |
| 2354 | { |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2357 | } |
| 2358 | |
| 2359 | /** |
| 2360 | * Smarty usage: {html_select_date_a11y legend="Published After" prefix="dateFrom" time=$dateFrom start_year=$yearStart end_year=$yearEnd} |
| 2361 | * |
| 2362 | * Get a fieldset of select fields to select a date |
| 2363 | * |
| 2364 | * Mimics basic features of Smarty's html_select_date function but |
| 2365 | * gives each select field a label and returns all fields within |
| 2366 | * a fieldset in order to be accessible. |
| 2367 | * |
| 2368 | * @param array $params |
| 2369 | * @param TemplateManager $smarty |
| 2370 | * |
| 2371 | * @return string |
| 2372 | */ |
| 2373 | public function smartyHtmlSelectDateA11y($params, $smarty) |
| 2374 | { |
| 2375 | if (!isset($params['prefix'], $params['legend'], $params['start_year'], $params['end_year'])) { |
| 2376 | throw new Exception('You must provide a prefix, legend, start_year and end_year when using html_select_date_a11y.'); |
| 2377 | } |
| 2378 | $prefix = $params['prefix']; |
| 2379 | $legend = $params['legend']; |
| 2380 | $time = $params['time'] ?? ''; |
| 2381 | $startYear = $params['start_year']; |
| 2382 | $endYear = $params['end_year']; |
| 2383 | $yearEmpty = $params['year_empty'] ?? ''; |
| 2384 | $monthEmpty = $params['month_empty'] ?? ''; |
| 2385 | $dayEmpty = $params['day_empty'] ?? ''; |
| 2386 | $yearLabel = $params['year_label'] ?? __('common.year'); |
| 2387 | $monthLabel = $params['month_label'] ?? __('common.month'); |
| 2388 | $dayLabel = $params['day_label'] ?? __('common.day'); |
| 2389 | |
| 2390 | $years = []; |
| 2391 | $i = $startYear; |
| 2392 | while ($i <= $endYear) { |
| 2393 | $years[$i] = $i; |
| 2394 | $i++; |
| 2395 | } |
| 2396 | |
| 2397 | $months = []; |
| 2398 | for ($i = 1; $i <= 12; $i++) { |
| 2399 | $months[$i] = date('M', strtotime('2020-' . $i . '-01')); |
| 2400 | } |
| 2401 | |
| 2402 | $days = []; |
| 2403 | for ($i = 1; $i <= 31; $i++) { |
| 2404 | $days[$i] = $i; |
| 2405 | } |
| 2406 | |
| 2407 | $currentYear = $currentMonth = $currentDay = ''; |
| 2408 | if ($time) { |
| 2409 | $currentYear = (int) substr($time, 0, 4); |
| 2410 | $currentMonth = (int) substr($time, 5, 2); |
| 2411 | $currentDay = (int) substr($time, 8, 2); |
| 2412 | } |
| 2413 | |
| 2414 | $output = '<fieldset><legend>' . $legend . '</legend>'; |
| 2415 | $output .= '<label for="' . $prefix . 'Year">' . $yearLabel . '</label>'; |
| 2416 | $output .= '<select id="' . $prefix . 'Year" name="' . $prefix . 'Year">'; |
| 2417 | $output .= '<option>' . $yearEmpty . '</option>'; |
| 2418 | foreach ($years as $value => $label) { |
| 2419 | $selected = $currentYear === $value ? ' selected' : ''; |
| 2420 | $output .= '<option value="' . $value . '"' . $selected . '>' . $label . '</option>'; |
| 2421 | } |
| 2422 | $output .= '</select>'; |
| 2423 | $output .= '<label for="' . $prefix . 'Month">' . $monthLabel . '</label>'; |
| 2424 | $output .= '<select id="' . $prefix . 'Month" name="' . $prefix . 'Month">'; |
| 2425 | $output .= '<option>' . $monthEmpty . '</option>'; |
| 2426 | foreach ($months as $value => $label) { |
| 2427 | $selected = $currentMonth === $value ? ' selected' : ''; |
| 2428 | $output .= '<option value="' . $value . '"' . $selected . '>' . $label . '</option>'; |
| 2429 | } |
| 2430 | $output .= '</select>'; |
| 2431 | $output .= '<label for="' . $prefix . 'Day">' . $dayLabel . '</label>'; |
| 2432 | $output .= '<select id="' . $prefix . 'Day" name="' . $prefix . 'Day">'; |
| 2433 | $output .= '<option>' . $dayEmpty . '</option>'; |
| 2434 | foreach ($days as $value => $label) { |
| 2435 | $selected = $currentDay === $value ? ' selected' : ''; |
| 2436 | $output .= '<option value="' . $value . '"' . $selected . '>' . $label . '</option>'; |
| 2437 | } |
| 2438 | $output .= '</select>'; |
| 2439 | $output .= '</fieldset>'; |
| 2440 | |
| 2441 | return $output; |
| 2442 | } |
| 2443 | |
| 2444 | /** |
| 2445 | * Defines the HTTP headers which will be appended to the output once the display() method gets called |
| 2446 | * |
| 2447 | * @param string[] List of formatted headers (['header: content', ...]) |
| 2448 | */ |
| 2449 | public function setHeaders(array $headers): static |
| 2450 | { |
| 2451 | $this->headers = $headers; |
| 2452 | return $this; |
| 2453 | } |
| 2454 | |
| 2455 | /** |
| 2456 | * Retrieves the headers |
| 2457 | * |
| 2458 | * @return string[] |
| 2459 | */ |
| 2460 | public function getHeaders(): array |
| 2461 | { |
| 2462 | return $this->headers; |
| 2463 | } |
| 2464 | } |
| 2465 | |
| 2466 | if (!PKP_STRICT_MODE) { |
| 2467 | class_alias('\PKP\template\PKPTemplateManager', '\PKPTemplateManager'); |
| 2468 | foreach ([ |
| 2469 | 'CACHEABILITY_NO_CACHE', 'CACHEABILITY_NO_STORE', 'CACHEABILITY_PUBLIC', 'CACHEABILITY_MUST_REVALIDATE', 'CACHEABILITY_PROXY_REVALIDATE', |
| 2470 | 'STYLE_SEQUENCE_CORE', 'STYLE_SEQUENCE_NORMAL', 'STYLE_SEQUENCE_LATE', 'STYLE_SEQUENCE_LAST', |
| 2471 | 'CSS_FILENAME_SUFFIX', |
| 2472 | 'PAGE_WIDTH_NARROW', 'PAGE_WIDTH_NORMAL', 'PAGE_WIDTH_WIDE', 'PAGE_WIDTH_FULL', |
| 2473 | ] as $constantName) { |
| 2474 | define($constantName, constant('\PKPTemplateManager::' . $constantName)); |
| 2475 | } |
| 2476 | } |
Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not
necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once.
Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 337 | $this->registerPlugin('modifier', 'concat', fn (...$args) => implode('', $args)); |
| 123 | parent::__construct(); |
| 124 | |
| 125 | // Set up Smarty configuration |
| 126 | $cachePath = Core::getBaseDir() . '/cache'; |
| 127 | $this->compile_dir = "{$cachePath}/t_compile"; |
| 128 | $this->config_dir = "{$cachePath}/t_config"; |
| 129 | $this->cache_dir = "{$cachePath}/t_cache"; |
| 130 | |
| 131 | // Register the template resources. |
| 132 | $this->registerResource('core', new PKPTemplateResource($coreTemplateDir = 'lib/pkp/templates')); |
| 133 | $this->registerResource('app', new PKPTemplateResource(['templates', $coreTemplateDir])); |
| 134 | $this->default_resource_type = 'app'; |
| 135 | |
| 136 | $this->error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING; |
| 137 | } |
| 603 | public function addHeader(string $name, string $header, array $args = []): void |
| 604 | { |
| 605 | $args = array_merge( |
| 606 | [ |
| 607 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 608 | 'contexts' => ['frontend'], |
| 609 | ], |
| 610 | $args |
| 611 | ); |
| 612 | |
| 613 | $args['contexts'] = (array) $args['contexts']; |
| 614 | foreach ($args['contexts'] as $context) { |
| 614 | foreach ($args['contexts'] as $context) { |
| 614 | foreach ($args['contexts'] as $context) { |
| 615 | $this->_htmlHeaders[$context][$args['priority']][$name] = [ |
| 614 | foreach ($args['contexts'] as $context) { |
| 614 | foreach ($args['contexts'] as $context) { |
| 615 | $this->_htmlHeaders[$context][$args['priority']][$name] = [ |
| 616 | 'header' => $header, |
| 617 | ]; |
| 618 | } |
| 619 | } |
| 603 | public function addHeader(string $name, string $header, array $args = []): void |
| 604 | { |
| 605 | $args = array_merge( |
| 606 | [ |
| 607 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 608 | 'contexts' => ['frontend'], |
| 609 | ], |
| 610 | $args |
| 611 | ); |
| 612 | |
| 613 | $args['contexts'] = (array) $args['contexts']; |
| 614 | foreach ($args['contexts'] as $context) { |
| 614 | foreach ($args['contexts'] as $context) { |
| 614 | foreach ($args['contexts'] as $context) { |
| 615 | $this->_htmlHeaders[$context][$args['priority']][$name] = [ |
| 616 | 'header' => $header, |
| 617 | ]; |
| 618 | } |
| 619 | } |
| 603 | public function addHeader(string $name, string $header, array $args = []): void |
| 604 | { |
| 605 | $args = array_merge( |
| 606 | [ |
| 607 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 608 | 'contexts' => ['frontend'], |
| 609 | ], |
| 610 | $args |
| 611 | ); |
| 612 | |
| 613 | $args['contexts'] = (array) $args['contexts']; |
| 614 | foreach ($args['contexts'] as $context) { |
| 614 | foreach ($args['contexts'] as $context) { |
| 615 | $this->_htmlHeaders[$context][$args['priority']][$name] = [ |
| 616 | 'header' => $header, |
| 617 | ]; |
| 618 | } |
| 619 | } |
| 572 | public function addJavaScript(string $name, string $script, array $args = []): void |
| 573 | { |
| 574 | $args = array_merge( |
| 575 | [ |
| 576 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 577 | 'contexts' => ['frontend'], |
| 578 | 'inline' => false, |
| 579 | ], |
| 580 | $args |
| 581 | ); |
| 582 | |
| 583 | $args['contexts'] = (array) $args['contexts']; |
| 584 | foreach ($args['contexts'] as $context) { |
| 584 | foreach ($args['contexts'] as $context) { |
| 584 | foreach ($args['contexts'] as $context) { |
| 585 | $this->_javaScripts[$context][$args['priority']][$name] = [ |
| 584 | foreach ($args['contexts'] as $context) { |
| 584 | foreach ($args['contexts'] as $context) { |
| 585 | $this->_javaScripts[$context][$args['priority']][$name] = [ |
| 586 | 'script' => $script, |
| 587 | 'inline' => $args['inline'], |
| 588 | ]; |
| 589 | } |
| 590 | } |
| 572 | public function addJavaScript(string $name, string $script, array $args = []): void |
| 573 | { |
| 574 | $args = array_merge( |
| 575 | [ |
| 576 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 577 | 'contexts' => ['frontend'], |
| 578 | 'inline' => false, |
| 579 | ], |
| 580 | $args |
| 581 | ); |
| 582 | |
| 583 | $args['contexts'] = (array) $args['contexts']; |
| 584 | foreach ($args['contexts'] as $context) { |
| 584 | foreach ($args['contexts'] as $context) { |
| 584 | foreach ($args['contexts'] as $context) { |
| 585 | $this->_javaScripts[$context][$args['priority']][$name] = [ |
| 586 | 'script' => $script, |
| 587 | 'inline' => $args['inline'], |
| 588 | ]; |
| 589 | } |
| 590 | } |
| 572 | public function addJavaScript(string $name, string $script, array $args = []): void |
| 573 | { |
| 574 | $args = array_merge( |
| 575 | [ |
| 576 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 577 | 'contexts' => ['frontend'], |
| 578 | 'inline' => false, |
| 579 | ], |
| 580 | $args |
| 581 | ); |
| 582 | |
| 583 | $args['contexts'] = (array) $args['contexts']; |
| 584 | foreach ($args['contexts'] as $context) { |
| 584 | foreach ($args['contexts'] as $context) { |
| 585 | $this->_javaScripts[$context][$args['priority']][$name] = [ |
| 586 | 'script' => $script, |
| 587 | 'inline' => $args['inline'], |
| 588 | ]; |
| 589 | } |
| 590 | } |
| 538 | public function addStyleSheet(string $name, string $style, array $args = []): void |
| 539 | { |
| 540 | $args = array_merge( |
| 541 | [ |
| 542 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 543 | 'contexts' => ['frontend'], |
| 544 | 'inline' => false, |
| 545 | ], |
| 546 | $args |
| 547 | ); |
| 548 | |
| 549 | $args['contexts'] = (array) $args['contexts']; |
| 550 | foreach ($args['contexts'] as $context) { |
| 550 | foreach ($args['contexts'] as $context) { |
| 550 | foreach ($args['contexts'] as $context) { |
| 551 | $this->_styleSheets[$context][$args['priority']][$name] = [ |
| 550 | foreach ($args['contexts'] as $context) { |
| 550 | foreach ($args['contexts'] as $context) { |
| 551 | $this->_styleSheets[$context][$args['priority']][$name] = [ |
| 552 | 'style' => $style, |
| 553 | 'inline' => $args['inline'], |
| 554 | ]; |
| 555 | } |
| 556 | } |
| 538 | public function addStyleSheet(string $name, string $style, array $args = []): void |
| 539 | { |
| 540 | $args = array_merge( |
| 541 | [ |
| 542 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 543 | 'contexts' => ['frontend'], |
| 544 | 'inline' => false, |
| 545 | ], |
| 546 | $args |
| 547 | ); |
| 548 | |
| 549 | $args['contexts'] = (array) $args['contexts']; |
| 550 | foreach ($args['contexts'] as $context) { |
| 550 | foreach ($args['contexts'] as $context) { |
| 550 | foreach ($args['contexts'] as $context) { |
| 551 | $this->_styleSheets[$context][$args['priority']][$name] = [ |
| 552 | 'style' => $style, |
| 553 | 'inline' => $args['inline'], |
| 554 | ]; |
| 555 | } |
| 556 | } |
| 538 | public function addStyleSheet(string $name, string $style, array $args = []): void |
| 539 | { |
| 540 | $args = array_merge( |
| 541 | [ |
| 542 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 543 | 'contexts' => ['frontend'], |
| 544 | 'inline' => false, |
| 545 | ], |
| 546 | $args |
| 547 | ); |
| 548 | |
| 549 | $args['contexts'] = (array) $args['contexts']; |
| 550 | foreach ($args['contexts'] as $context) { |
| 550 | foreach ($args['contexts'] as $context) { |
| 551 | $this->_styleSheets[$context][$args['priority']][$name] = [ |
| 552 | 'style' => $style, |
| 553 | 'inline' => $args['inline'], |
| 554 | ]; |
| 555 | } |
| 556 | } |
| 501 | public function cacheLess(string $path, string $styles): bool |
| 502 | { |
| 503 | if (file_put_contents($path, $styles) === false) { |
| 504 | error_log("Unable to write \"{$path}\"."); |
| 505 | return false; |
| 501 | public function cacheLess(string $path, string $styles): bool |
| 502 | { |
| 503 | if (file_put_contents($path, $styles) === false) { |
| 508 | return true; |
| 509 | } |
| 1334 | $cacheDirectory = Core::getBaseDir() . '/cache'; |
| 1335 | array_map('unlink', glob($cacheDirectory . '/*.' . self::CSS_FILENAME_SUFFIX)); |
| 1336 | } |
| 1325 | $this->clearCompiledTemplate(); |
| 1326 | $this->clearAllCache(); |
| 1327 | } |
| 1350 | public function clearThemeTemplateCache($hookName, $args) |
| 1351 | { |
| 1352 | $newContextOrSite = $args[0]; |
| 1353 | $contextOrSite = $args[1]; |
| 1354 | if ($newContextOrSite->getData('themePluginPath') !== $contextOrSite->getData('themePluginPath')) { |
| 1355 | $this->clearTemplateCache(); |
| 1356 | $this->clearCssCache(); |
| 1357 | } |
| 1358 | } |
| 1358 | } |
| 1350 | public function clearThemeTemplateCache($hookName, $args) |
| 1351 | { |
| 1352 | $newContextOrSite = $args[0]; |
| 1353 | $contextOrSite = $args[1]; |
| 1354 | if ($newContextOrSite->getData('themePluginPath') !== $contextOrSite->getData('themePluginPath')) { |
| 1358 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 476 | foreach ($args['addLess'] as $addless) { |
| 477 | $less->parseFile($addless); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // Add extra LESS variables before compiling |
| 482 | if (isset($args['addLessVariables'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 483 | foreach ((array) $args['addLessVariables'] as $addlessVariables) { |
| 484 | $less->parse($addlessVariables); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // Set the @baseUrl variable |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 459 | public function compileLess(string $name, string $lessFile, array $args = []): string |
| 460 | { |
| 461 | $less = new Less_Parser([ |
| 462 | 'relativeUrls' => false, |
| 463 | 'compress' => true, |
| 464 | ]); |
| 465 | |
| 466 | $request = $this->_request; |
| 467 | |
| 468 | // Allow plugins to intervene |
| 469 | Hook::call('PageHandler::compileLess', [&$less, &$lessFile, &$args, $name, $request]); |
| 470 | |
| 471 | // Read the stylesheet |
| 472 | $less->parseFile($lessFile); |
| 473 | |
| 474 | // Add extra LESS files before compiling |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 475 | if (isset($args['addLess']) && is_array($args['addLess'])) { |
| 482 | if (isset($args['addLessVariables'])) { |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 489 | $baseUrl = !empty($args['baseUrl']) ? $args['baseUrl'] : $request->getBaseUrl(true); |
| 490 | $less->parse("@baseUrl: '{$baseUrl}';"); |
| 491 | |
| 492 | return $less->getCSS(); |
| 493 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1290 | echo $output; |
| 1291 | return; |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1290 | echo $output; |
| 1291 | return; |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1290 | echo $output; |
| 1291 | return; |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1290 | echo $output; |
| 1291 | return; |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1290 | echo $output; |
| 1291 | return; |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1235 | $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; |
| 1236 | } |
| 1237 | |
| 1238 | // add apiBaselUrl for useApiUrl composable |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1290 | echo $output; |
| 1291 | return; |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1290 | echo $output; |
| 1291 | return; |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1290 | echo $output; |
| 1291 | return; |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1260 | $userGroups = Repo::userGroup()->userUserGroups($user->getId()); |
| 1261 | |
| 1262 | $userRoles = []; |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1263 | foreach ($userGroups as $userGroup) { |
| 1264 | $userRoles[] = (int) $userGroup->getRoleId(); |
| 1265 | } |
| 1266 | $currentUser = [ |
| 1267 | 'csrfToken' => $this->_request->getSession()->token(), |
| 1268 | 'id' => (int) $user->getId(), |
| 1269 | 'roles' => array_values(array_unique($userRoles)), |
| 1270 | ]; |
| 1271 | $output .= 'pkp.currentUser = ' . json_encode($currentUser) . ';'; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | $this->addJavaScript( |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1290 | echo $output; |
| 1291 | return; |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1258 | $user = $this->_request->getUser(); |
| 1259 | if ($user) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1290 | echo $output; |
| 1291 | return; |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1313 | $compile_id = $this->getCompileId($template); |
| 1314 | } |
| 1315 | |
| 1316 | // Actually display the template. |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1230 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1231 | { |
| 1232 | // Output global constants and locale keys used in new component library |
| 1233 | $output = 'window.pkp = window.pkp || {};'; |
| 1234 | if (!empty($this->_constants)) { |
| 1239 | $dispatcher = Application::get()->getDispatcher(); |
| 1240 | $request = Application::get()->getRequest(); |
| 1241 | $context = $request->getContext(); |
| 1242 | |
| 1243 | $pageContext = [ |
| 1244 | 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: Application::SITE_CONTEXT_PATH), |
| 1245 | 'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: Application::SITE_CONTEXT_PATH) . '/', |
| 1246 | 'legacyGridBaseUrl' => $dispatcher->url( |
| 1247 | $request, |
| 1248 | Application::ROUTE_COMPONENT, |
| 1249 | null, |
| 1250 | 'componentHandler', |
| 1251 | 'action', |
| 1252 | null, |
| 1253 | )]; |
| 1254 | $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; |
| 1255 | |
| 1256 | // Load current user data |
| 1257 | if (Application::isInstalled()) { |
| 1275 | $this->addJavaScript( |
| 1276 | 'pkpAppData', |
| 1277 | $output, |
| 1278 | [ |
| 1279 | 'priority' => self::STYLE_SEQUENCE_NORMAL, |
| 1280 | 'contexts' => ['backend'], |
| 1281 | 'inline' => true, |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | // Give any hooks registered against the TemplateManager |
| 1286 | // the opportunity to modify behavior; otherwise, display |
| 1287 | // the template as usual. |
| 1288 | $output = null; |
| 1289 | if (Hook::call('TemplateManager::display', [$this, &$template, &$output])) { |
| 1295 | $this->assign('state', $this->_state); |
| 1296 | |
| 1297 | // Explicitly set the character encoding. Required in |
| 1298 | // case server is using Apache's AddDefaultCharset |
| 1299 | // directive (which can prevent browser auto-detection |
| 1300 | // of the proper character set). |
| 1301 | header('content-type: text/html; charset=utf-8'); |
| 1302 | header("cache-control: {$this->_cacheability}"); |
| 1303 | |
| 1304 | foreach ($this->headers as $header) { |
| 1304 | foreach ($this->headers as $header) { |
| 1305 | header($header); |
| 1306 | } |
| 1307 | |
| 1308 | // sent out the cookie as header |
| 1309 | Application::get()->getRequest()->getSessionGuard()->sendCookies(); |
| 1310 | |
| 1311 | // If no compile ID was assigned, get one. |
| 1312 | if (!$compile_id) { |
| 1317 | parent::display($template, $cache_id, $compile_id, $parent); |
| 1318 | } |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1412 | if ($this->_request->getContext()) { |
| 1413 | $blocks = $this->_request->getContext()->getData('sidebar'); |
| 1418 | if (empty($blocks)) { |
| 1419 | return false; |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1412 | if ($this->_request->getContext()) { |
| 1413 | $blocks = $this->_request->getContext()->getData('sidebar'); |
| 1418 | if (empty($blocks)) { |
| 1422 | $plugins = PluginRegistry::loadCategory('blocks', true); |
| 1423 | if (empty($plugins)) { |
| 1424 | return false; |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1412 | if ($this->_request->getContext()) { |
| 1413 | $blocks = $this->_request->getContext()->getData('sidebar'); |
| 1418 | if (empty($blocks)) { |
| 1422 | $plugins = PluginRegistry::loadCategory('blocks', true); |
| 1423 | if (empty($plugins)) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1429 | $output .= $plugins[$pluginName]->getContents($smarty, $this->_request); |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1429 | $output .= $plugins[$pluginName]->getContents($smarty, $this->_request); |
| 1430 | } |
| 1431 | } |
| 1432 | |
| 1433 | return false; |
| 1434 | } |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1412 | if ($this->_request->getContext()) { |
| 1413 | $blocks = $this->_request->getContext()->getData('sidebar'); |
| 1418 | if (empty($blocks)) { |
| 1422 | $plugins = PluginRegistry::loadCategory('blocks', true); |
| 1423 | if (empty($plugins)) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1429 | $output .= $plugins[$pluginName]->getContents($smarty, $this->_request); |
| 1430 | } |
| 1431 | } |
| 1432 | |
| 1433 | return false; |
| 1434 | } |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1412 | if ($this->_request->getContext()) { |
| 1413 | $blocks = $this->_request->getContext()->getData('sidebar'); |
| 1418 | if (empty($blocks)) { |
| 1422 | $plugins = PluginRegistry::loadCategory('blocks', true); |
| 1423 | if (empty($plugins)) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1429 | $output .= $plugins[$pluginName]->getContents($smarty, $this->_request); |
| 1430 | } |
| 1431 | } |
| 1432 | |
| 1433 | return false; |
| 1434 | } |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1412 | if ($this->_request->getContext()) { |
| 1413 | $blocks = $this->_request->getContext()->getData('sidebar'); |
| 1418 | if (empty($blocks)) { |
| 1422 | $plugins = PluginRegistry::loadCategory('blocks', true); |
| 1423 | if (empty($plugins)) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1429 | $output .= $plugins[$pluginName]->getContents($smarty, $this->_request); |
| 1430 | } |
| 1431 | } |
| 1432 | |
| 1433 | return false; |
| 1434 | } |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1415 | $blocks = $this->_request->getSite()->getData('sidebar'); |
| 1416 | } |
| 1417 | |
| 1418 | if (empty($blocks)) { |
| 1418 | if (empty($blocks)) { |
| 1419 | return false; |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1415 | $blocks = $this->_request->getSite()->getData('sidebar'); |
| 1416 | } |
| 1417 | |
| 1418 | if (empty($blocks)) { |
| 1418 | if (empty($blocks)) { |
| 1422 | $plugins = PluginRegistry::loadCategory('blocks', true); |
| 1423 | if (empty($plugins)) { |
| 1424 | return false; |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1415 | $blocks = $this->_request->getSite()->getData('sidebar'); |
| 1416 | } |
| 1417 | |
| 1418 | if (empty($blocks)) { |
| 1418 | if (empty($blocks)) { |
| 1422 | $plugins = PluginRegistry::loadCategory('blocks', true); |
| 1423 | if (empty($plugins)) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1429 | $output .= $plugins[$pluginName]->getContents($smarty, $this->_request); |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1429 | $output .= $plugins[$pluginName]->getContents($smarty, $this->_request); |
| 1430 | } |
| 1431 | } |
| 1432 | |
| 1433 | return false; |
| 1434 | } |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1415 | $blocks = $this->_request->getSite()->getData('sidebar'); |
| 1416 | } |
| 1417 | |
| 1418 | if (empty($blocks)) { |
| 1418 | if (empty($blocks)) { |
| 1422 | $plugins = PluginRegistry::loadCategory('blocks', true); |
| 1423 | if (empty($plugins)) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1429 | $output .= $plugins[$pluginName]->getContents($smarty, $this->_request); |
| 1430 | } |
| 1431 | } |
| 1432 | |
| 1433 | return false; |
| 1434 | } |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1415 | $blocks = $this->_request->getSite()->getData('sidebar'); |
| 1416 | } |
| 1417 | |
| 1418 | if (empty($blocks)) { |
| 1418 | if (empty($blocks)) { |
| 1422 | $plugins = PluginRegistry::loadCategory('blocks', true); |
| 1423 | if (empty($plugins)) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1429 | $output .= $plugins[$pluginName]->getContents($smarty, $this->_request); |
| 1430 | } |
| 1431 | } |
| 1432 | |
| 1433 | return false; |
| 1434 | } |
| 1406 | public function displaySidebar(string $hookName, array $args): bool |
| 1407 | { |
| 1408 | $params = &$args[0]; |
| 1409 | $smarty = &$args[1]; |
| 1410 | $output = &$args[2]; |
| 1411 | |
| 1412 | if ($this->_request->getContext()) { |
| 1415 | $blocks = $this->_request->getSite()->getData('sidebar'); |
| 1416 | } |
| 1417 | |
| 1418 | if (empty($blocks)) { |
| 1418 | if (empty($blocks)) { |
| 1422 | $plugins = PluginRegistry::loadCategory('blocks', true); |
| 1423 | if (empty($plugins)) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1427 | foreach ($blocks as $pluginName) { |
| 1428 | if (!empty($plugins[$pluginName])) { |
| 1429 | $output .= $plugins[$pluginName]->getContents($smarty, $this->_request); |
| 1430 | } |
| 1431 | } |
| 1432 | |
| 1433 | return false; |
| 1434 | } |
| 1160 | public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1161 | { |
| 1162 | // If no compile ID was assigned, get one. |
| 1163 | if (!$compile_id) { |
| 1164 | $compile_id = $this->getCompileId($template); |
| 1165 | } |
| 1166 | |
| 1167 | // Give hooks an opportunity to override |
| 1168 | $result = null; |
| 1168 | $result = null; |
| 1169 | if (Hook::call('TemplateManager::fetch', [$this, $template, $cache_id, $compile_id, &$result])) { |
| 1170 | return $result; |
| 1160 | public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1161 | { |
| 1162 | // If no compile ID was assigned, get one. |
| 1163 | if (!$compile_id) { |
| 1164 | $compile_id = $this->getCompileId($template); |
| 1165 | } |
| 1166 | |
| 1167 | // Give hooks an opportunity to override |
| 1168 | $result = null; |
| 1168 | $result = null; |
| 1169 | if (Hook::call('TemplateManager::fetch', [$this, $template, $cache_id, $compile_id, &$result])) { |
| 1173 | return parent::fetch($template, $cache_id, $compile_id, $parent); |
| 1174 | } |
| 1160 | public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1161 | { |
| 1162 | // If no compile ID was assigned, get one. |
| 1163 | if (!$compile_id) { |
| 1168 | $result = null; |
| 1169 | if (Hook::call('TemplateManager::fetch', [$this, $template, $cache_id, $compile_id, &$result])) { |
| 1170 | return $result; |
| 1160 | public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null) |
| 1161 | { |
| 1162 | // If no compile ID was assigned, get one. |
| 1163 | if (!$compile_id) { |
| 1168 | $result = null; |
| 1169 | if (Hook::call('TemplateManager::fetch', [$this, $template, $cache_id, $compile_id, &$result])) { |
| 1173 | return parent::fetch($template, $cache_id, $compile_id, $parent); |
| 1174 | } |
| 1183 | public function fetchAjax(string $id, string $url, string $element = 'div'): JSONMessage |
| 1184 | { |
| 1185 | return new JSONMessage(true, $this->smartyLoadUrlInEl( |
| 1186 | [ |
| 1187 | 'url' => $url, |
| 1188 | 'id' => $id, |
| 1189 | 'el' => $element, |
| 1190 | ], |
| 1191 | $this |
| 1192 | )); |
| 1193 | } |
| 1215 | public function fetchJson(string $template, bool $status = true): JSONMessage |
| 1216 | { |
| 1217 | return new JSONMessage($status, $this->fetch($template)); |
| 1218 | } |
| 1648 | while (ob_get_level()) { |
| 1648 | while (ob_get_level()) { |
| 1651 | flush(); |
| 1652 | } |
| 1648 | while (ob_get_level()) { |
| 1648 | while (ob_get_level()) { |
| 1648 | while (ob_get_level()) { |
| 1649 | ob_end_flush(); |
| 1648 | while (ob_get_level()) { |
| 1651 | flush(); |
| 1652 | } |
| 516 | public function getCachedLessFilePath(string $name): string |
| 517 | { |
| 518 | $directory = Core::getBaseDir() . '/cache'; |
| 519 | $contextId = $this->_request->getContext()?->getId() ?? PKPApplication::CONTEXT_SITE; |
| 520 | $hash = crc32($this->_request->getBaseUrl()); |
| 521 | return "{$directory}/{$contextId}-{$name}-{$hash}.css"; |
| 522 | } |
| 1198 | public function getCompileId(string $resourceName): string |
| 1199 | { |
| 1200 | if (Application::isInstalled()) { |
| 1201 | $context = $this->_request->getContext(); |
| 1202 | if ($context instanceof Context) { |
| 1203 | $resourceName .= $context->getData('themePluginPath'); |
| 1204 | } |
| 1205 | } |
| 1206 | |
| 1207 | return sha1($resourceName); |
| 1207 | return sha1($resourceName); |
| 1208 | } |
| 1198 | public function getCompileId(string $resourceName): string |
| 1199 | { |
| 1200 | if (Application::isInstalled()) { |
| 1201 | $context = $this->_request->getContext(); |
| 1202 | if ($context instanceof Context) { |
| 1207 | return sha1($resourceName); |
| 1208 | } |
| 1198 | public function getCompileId(string $resourceName): string |
| 1199 | { |
| 1200 | if (Application::isInstalled()) { |
| 1207 | return sha1($resourceName); |
| 1208 | } |
| 1390 | if (!isset($this->_fbv)) { |
| 1391 | $this->_fbv = new FormBuilderVocabulary(); |
| 1392 | } |
| 1393 | return $this->_fbv; |
| 1393 | return $this->_fbv; |
| 1394 | } |
| 1390 | if (!isset($this->_fbv)) { |
| 1393 | return $this->_fbv; |
| 1394 | } |
| 2462 | return $this->headers; |
| 2463 | } |
| 1363 | public static function &getManager(?PKPRequest $request = null): TemplateManager |
| 1364 | { |
| 1365 | if (!isset($request)) { |
| 1366 | $request = Registry::get('request'); |
| 1367 | if (Config::getVar('debug', 'deprecation_warnings')) { |
| 1368 | throw new Exception('Deprecated call without request object.'); |
| 1363 | public static function &getManager(?PKPRequest $request = null): TemplateManager |
| 1364 | { |
| 1365 | if (!isset($request)) { |
| 1366 | $request = Registry::get('request'); |
| 1367 | if (Config::getVar('debug', 'deprecation_warnings')) { |
| 1371 | $instance = &Registry::get('templateManager', true, null); // Reference required |
| 1372 | |
| 1373 | if ($instance === null) { |
| 1374 | $instance = new TemplateManager(); |
| 1375 | $themes = PluginRegistry::getPlugins('themes'); |
| 1376 | if (empty($themes)) { |
| 1377 | $themes = PluginRegistry::loadCategory('themes', true); |
| 1378 | } |
| 1379 | $instance->initialize($request); |
| 1379 | $instance->initialize($request); |
| 1380 | } |
| 1381 | |
| 1382 | return $instance; |
| 1382 | return $instance; |
| 1383 | } |
| 1363 | public static function &getManager(?PKPRequest $request = null): TemplateManager |
| 1364 | { |
| 1365 | if (!isset($request)) { |
| 1366 | $request = Registry::get('request'); |
| 1367 | if (Config::getVar('debug', 'deprecation_warnings')) { |
| 1371 | $instance = &Registry::get('templateManager', true, null); // Reference required |
| 1372 | |
| 1373 | if ($instance === null) { |
| 1374 | $instance = new TemplateManager(); |
| 1375 | $themes = PluginRegistry::getPlugins('themes'); |
| 1376 | if (empty($themes)) { |
| 1379 | $instance->initialize($request); |
| 1380 | } |
| 1381 | |
| 1382 | return $instance; |
| 1382 | return $instance; |
| 1383 | } |
| 1363 | public static function &getManager(?PKPRequest $request = null): TemplateManager |
| 1364 | { |
| 1365 | if (!isset($request)) { |
| 1366 | $request = Registry::get('request'); |
| 1367 | if (Config::getVar('debug', 'deprecation_warnings')) { |
| 1371 | $instance = &Registry::get('templateManager', true, null); // Reference required |
| 1372 | |
| 1373 | if ($instance === null) { |
| 1382 | return $instance; |
| 1383 | } |
| 1363 | public static function &getManager(?PKPRequest $request = null): TemplateManager |
| 1364 | { |
| 1365 | if (!isset($request)) { |
| 1371 | $instance = &Registry::get('templateManager', true, null); // Reference required |
| 1372 | |
| 1373 | if ($instance === null) { |
| 1374 | $instance = new TemplateManager(); |
| 1375 | $themes = PluginRegistry::getPlugins('themes'); |
| 1376 | if (empty($themes)) { |
| 1377 | $themes = PluginRegistry::loadCategory('themes', true); |
| 1378 | } |
| 1379 | $instance->initialize($request); |
| 1379 | $instance->initialize($request); |
| 1380 | } |
| 1381 | |
| 1382 | return $instance; |
| 1382 | return $instance; |
| 1383 | } |
| 1363 | public static function &getManager(?PKPRequest $request = null): TemplateManager |
| 1364 | { |
| 1365 | if (!isset($request)) { |
| 1371 | $instance = &Registry::get('templateManager', true, null); // Reference required |
| 1372 | |
| 1373 | if ($instance === null) { |
| 1374 | $instance = new TemplateManager(); |
| 1375 | $themes = PluginRegistry::getPlugins('themes'); |
| 1376 | if (empty($themes)) { |
| 1379 | $instance->initialize($request); |
| 1380 | } |
| 1381 | |
| 1382 | return $instance; |
| 1382 | return $instance; |
| 1383 | } |
| 1363 | public static function &getManager(?PKPRequest $request = null): TemplateManager |
| 1364 | { |
| 1365 | if (!isset($request)) { |
| 1371 | $instance = &Registry::get('templateManager', true, null); // Reference required |
| 1372 | |
| 1373 | if ($instance === null) { |
| 1382 | return $instance; |
| 1383 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2236 | $matches = $resources[$context]; |
| 2237 | } |
| 2238 | |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 2231 | public function getResourcesByContext($resources, $context) |
| 2232 | { |
| 2233 | $matches = []; |
| 2234 | |
| 2235 | if (array_key_exists($context, $resources)) { |
| 2239 | $page = $this->getTemplateVars('requestedPage'); |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2240 | $page = empty($page) ? 'index' : $page; |
| 2241 | $op = $this->getTemplateVars('requestedOp'); |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2242 | $op = empty($op) ? 'index' : $op; |
| 2243 | |
| 2244 | $contexts = [ |
| 2245 | join('-', [$context, $page]), |
| 2246 | join('-', [$context, $page, $op]), |
| 2247 | ]; |
| 2248 | |
| 2249 | foreach ($contexts as $context) { |
| 2249 | foreach ($contexts as $context) { |
| 2250 | if (array_key_exists($context, $resources)) { |
| 2251 | foreach ($resources[$context] as $priority => $priorityList) { |
| 2252 | if (!array_key_exists($priority, $matches)) { |
| 2253 | $matches[$priority] = []; |
| 2254 | } |
| 2255 | $matches[$priority] = array_merge($matches[$priority], $resources[$context][$priority]); |
| 2256 | } |
| 2257 | $matches += $resources[$context]; |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | return $matches; |
| 2262 | } |
| 634 | public function getState(string $key): mixed |
| 635 | { |
| 636 | return array_key_exists($key, $this->_state) |
| 637 | ? $this->_state[$key] |
| 638 | : null; |
| 639 | } |
| 634 | public function getState(string $key): mixed |
| 635 | { |
| 636 | return array_key_exists($key, $this->_state) |
| 638 | : null; |
| 638 | : null; |
| 639 | } |
| 1439 | public function getTinyMceSkinUrl(Request $request): string |
| 1440 | { |
| 1441 | return $request->getBaseUrl() . '/lib/pkp/styles/tinymce'; |
| 1442 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2052 | return $htmlContent; |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2064 | return $htmlContent; |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2064 | return $htmlContent; |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2064 | return $htmlContent; |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2064 | return $htmlContent; |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2071 | ksort($styles); |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2072 | foreach ($styles as $priorityGroup) { |
| 2073 | foreach ($priorityGroup as $htmlStyle) { |
| 2074 | if (!empty($htmlStyle['inline'])) { |
| 2075 | $links .= '<style type="text/css">' . $htmlStyle['style'] . '</style>' . "\n"; |
| 2076 | } else { |
| 2077 | $links .= '<link rel="stylesheet" href="' . $htmlStyle['style'] . '" type="text/css">' . "\n"; |
| 2078 | } |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 2049 | public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) |
| 2050 | { |
| 2051 | if (empty($htmlContent)) { |
| 2055 | $hasEmbeddedStyle = false; |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2056 | foreach ($embeddedFiles as $embeddedFile) { |
| 2057 | if ($embeddedFile->getData('mimetype') === 'text/css') { |
| 2058 | $hasEmbeddedStyle = true; |
| 2059 | break; |
| 2060 | } |
| 2061 | } |
| 2062 | |
| 2063 | if ($hasEmbeddedStyle) { |
| 2067 | $links = ''; |
| 2068 | $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); |
| 2069 | |
| 2070 | if (!empty($styles)) { |
| 2083 | return str_ireplace('<head>', '<head>' . "\n" . $links, $htmlContent); |
| 2084 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 706 | $this->addJavaScript( |
| 707 | 'pkpLib', |
| 708 | $baseUrl . '/js/pkp.min.js', |
| 709 | [ |
| 710 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 711 | 'contexts' => ['backend'] |
| 712 | ] |
| 713 | ); |
| 714 | return; |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 654 | $baseUrl = $this->_request->getBaseUrl(); |
| 655 | $localeChecks = [Locale::getLocale(), strtolower(substr(Locale::getLocale(), 0, 2))]; |
| 656 | |
| 657 | // Common $args array used for all our core JS files |
| 658 | $args = [ |
| 659 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 660 | 'contexts' => 'backend', |
| 661 | ]; |
| 662 | |
| 663 | // Load jQuery validate separately because it can not be linted |
| 664 | // properly by our build script |
| 665 | $this->addJavaScript( |
| 666 | 'jqueryValidate', |
| 667 | $baseUrl . '/js/build/jquery-validation/jquery.validate.min.js', |
| 668 | $args |
| 669 | ); |
| 670 | $jqvLocalePath = 'js/build/jquery-validation/localization/messages_'; |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 671 | foreach ($localeChecks as $localeCheck) { |
| 672 | if (file_exists($jqvLocalePath . $localeCheck . '.js')) { |
| 673 | $this->addJavaScript('jqueryValidateLocale', $baseUrl . '/' . $jqvLocalePath . $localeCheck . '.js', $args); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | $this->addJavaScript( |
| 678 | 'plUpload', |
| 679 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/plupload.full.min.js', |
| 680 | $args |
| 681 | ); |
| 682 | $this->addJavaScript( |
| 683 | 'jQueryPlUpload', |
| 684 | $baseUrl . '/lib/pkp/lib/vendor/moxiecode/plupload/js/jquery.ui.plupload/jquery.ui.plupload.js', |
| 685 | $args |
| 686 | ); |
| 687 | $plLocalePath = 'lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/'; |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 688 | foreach ($localeChecks as $localeCheck) { |
| 689 | if (file_exists($plLocalePath . $localeCheck . '.js')) { |
| 690 | $this->addJavaScript('plUploadLocale', $baseUrl . '/' . $plLocalePath . $localeCheck . '.js', $args); |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | // Load new component library bundle |
| 695 | $this->addJavaScript( |
| 696 | 'pkpApp', |
| 697 | $baseUrl . '/js/build.js', |
| 698 | [ |
| 699 | 'priority' => self::STYLE_SEQUENCE_LATE, |
| 700 | 'contexts' => ['backend'] |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | // Load minified file if it exists |
| 705 | if (Config::getVar('general', 'enable_minified')) { |
| 718 | $minifiedScripts = array_filter(array_map('trim', file('registry/minifiedScripts.txt')), function ($s) { |
| 719 | return strlen($s) && $s[0] != '#'; // Exclude empty and commented (#) lines |
| 720 | }); |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 721 | foreach ($minifiedScripts as $key => $script) { |
| 722 | $this->addJavaScript('pkpLib' . $key, "{$baseUrl}/{$script}", $args); |
| 723 | } |
| 724 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 757 | if ($context) { |
| 758 | $allLocales = array_merge( |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 765 | $allLocales = $this->_request->getSite()->getSupportedLocales(); |
| 766 | } |
| 767 | $allLocales = array_unique($allLocales); |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 757 | if ($context) { |
| 758 | $allLocales = array_merge( |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 765 | $allLocales = $this->_request->getSite()->getSupportedLocales(); |
| 766 | } |
| 767 | $allLocales = array_unique($allLocales); |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 757 | if ($context) { |
| 758 | $allLocales = array_merge( |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 765 | $allLocales = $this->_request->getSite()->getSupportedLocales(); |
| 766 | } |
| 767 | $allLocales = array_unique($allLocales); |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 757 | if ($context) { |
| 758 | $allLocales = array_merge( |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 765 | $allLocales = $this->_request->getSite()->getSupportedLocales(); |
| 766 | } |
| 767 | $allLocales = array_unique($allLocales); |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 757 | if ($context) { |
| 758 | $allLocales = array_merge( |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 765 | $allLocales = $this->_request->getSite()->getSupportedLocales(); |
| 766 | } |
| 767 | $allLocales = array_unique($allLocales); |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 757 | if ($context) { |
| 758 | $allLocales = array_merge( |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 765 | $allLocales = $this->_request->getSite()->getSupportedLocales(); |
| 766 | } |
| 767 | $allLocales = array_unique($allLocales); |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 757 | if ($context) { |
| 758 | $allLocales = array_merge( |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 765 | $allLocales = $this->_request->getSite()->getSupportedLocales(); |
| 766 | } |
| 767 | $allLocales = array_unique($allLocales); |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 757 | if ($context) { |
| 758 | $allLocales = array_merge( |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 756 | $allLocales = []; |
| 757 | if ($context) { |
| 765 | $allLocales = $this->_request->getSite()->getSupportedLocales(); |
| 766 | } |
| 767 | $allLocales = array_unique($allLocales); |
| 767 | $allLocales = array_unique($allLocales); |
| 768 | $rtlLocales = array_filter($allLocales, fn (string $locale) => Locale::getMetadata($locale)?->isRightToLeft()); |
| 769 | $app_data['rtlLocales'] = array_values($rtlLocales); |
| 770 | } |
| 771 | |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 738 | $context = $this->_request->getContext(); |
| 739 | |
| 740 | // Instantiate the namespace |
| 741 | $output = '$.pkp = $.pkp || {};'; |
| 742 | |
| 743 | $app_data = [ |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 744 | 'currentLocale' => Locale::getLocale(), |
| 745 | 'primaryLocale' => Locale::getPrimaryLocale(), |
| 746 | 'baseUrl' => $this->_request->getBaseUrl(), |
| 747 | 'contextPath' => isset($context) ? $context->getPath() : '', |
| 748 | 'apiBasePath' => '/api/v1', |
| 749 | 'restfulUrlsEnabled' => Config::getVar('general', 'restful_urls') ? true : false, |
| 750 | 'tinyMceContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content.css', |
| 751 | 'tinyMceOneLineContentCSS' => $this->_request->getBaseUrl() . '/plugins/generic/tinymce/styles/content_oneline.css', |
| 752 | ]; |
| 753 | |
| 754 | // Add an array of rtl languages (right-to-left) |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 755 | if (Application::isInstalled() && !PKPSessionGuard::isSessionDisable()) { |
| 772 | $output .= '$.pkp.app = ' . json_encode($app_data) . ';'; |
| 773 | |
| 774 | // Load exposed constants |
| 775 | $output .= '$.pkp.cons = ' . json_encode($this->_constants) . ';'; |
| 776 | |
| 777 | // Allow plugins to load data within their own namespace |
| 778 | $output .= '$.pkp.plugins = {};'; |
| 779 | |
| 780 | $this->addJavaScript( |
| 781 | 'pkpLibData', |
| 782 | $output, |
| 783 | [ |
| 784 | 'priority' => self::STYLE_SEQUENCE_CORE, |
| 785 | 'contexts' => 'backend', |
| 786 | 'inline' => true, |
| 787 | ] |
| 788 | ); |
| 789 | } |
| 441 | public function setCacheability(string $cacheability = self::CACHEABILITY_PUBLIC): void |
| 442 | { |
| 443 | $this->_cacheability = $cacheability; |
| 444 | } |
| 626 | public function setConstants(array $constants): void |
| 627 | { |
| 628 | $this->_constants = array_merge($this->_constants, $constants); |
| 629 | } |
| 2449 | public function setHeaders(array $headers): static |
| 2450 | { |
| 2451 | $this->headers = $headers; |
| 2452 | return $this; |
| 2453 | } |
| 644 | public function setState(array $data) |
| 645 | { |
| 646 | $this->_state = array_merge($this->_state, $data); |
| 647 | } |
| 1984 | public function smartyCSRF($params, $smarty) |
| 1985 | { |
| 1986 | $csrfToken = $this->_request->getSession()->token(); |
| 1987 | switch ($params['type'] ?? null) { |
| 1988 | case 'raw': return $csrfToken; |
| 1989 | case 'json': return json_encode($csrfToken); |
| 1990 | case 'html': |
| 1990 | case 'html': |
| 1992 | return '<input type="hidden" name="csrfToken" value="' . htmlspecialchars($csrfToken) . '">'; |
| 1993 | } |
| 1994 | } |
| 1984 | public function smartyCSRF($params, $smarty) |
| 1985 | { |
| 1986 | $csrfToken = $this->_request->getSession()->token(); |
| 1987 | switch ($params['type'] ?? null) { |
| 1988 | case 'raw': return $csrfToken; |
| 1989 | case 'json': return json_encode($csrfToken); |
| 1990 | case 'html': |
| 1992 | return '<input type="hidden" name="csrfToken" value="' . htmlspecialchars($csrfToken) . '">'; |
| 1993 | } |
| 1994 | } |
| 1984 | public function smartyCSRF($params, $smarty) |
| 1985 | { |
| 1986 | $csrfToken = $this->_request->getSession()->token(); |
| 1987 | switch ($params['type'] ?? null) { |
| 1988 | case 'raw': return $csrfToken; |
| 1989 | case 'json': return json_encode($csrfToken); |
| 1989 | case 'json': return json_encode($csrfToken); |
| 1984 | public function smartyCSRF($params, $smarty) |
| 1985 | { |
| 1986 | $csrfToken = $this->_request->getSession()->token(); |
| 1987 | switch ($params['type'] ?? null) { |
| 1988 | case 'raw': return $csrfToken; |
| 1988 | case 'raw': return $csrfToken; |
| 1657 | public function smartyCallHook($params, $smarty) |
| 1658 | { |
| 1659 | $output = null; |
| 1660 | Hook::call($params['name'], [&$params, $smarty, &$output]); |
| 1661 | return $output; |
| 1662 | } |
| 1878 | public function smartyCompare($a, $b, $strict = false, $invert = false) |
| 1879 | { |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1881 | return $invert ? !$result : $result; |
| 1881 | return $invert ? !$result : $result; |
| 1881 | return $invert ? !$result : $result; |
| 1882 | } |
| 1878 | public function smartyCompare($a, $b, $strict = false, $invert = false) |
| 1879 | { |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1881 | return $invert ? !$result : $result; |
| 1881 | return $invert ? !$result : $result; |
| 1881 | return $invert ? !$result : $result; |
| 1882 | } |
| 1878 | public function smartyCompare($a, $b, $strict = false, $invert = false) |
| 1879 | { |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1881 | return $invert ? !$result : $result; |
| 1881 | return $invert ? !$result : $result; |
| 1881 | return $invert ? !$result : $result; |
| 1882 | } |
| 1878 | public function smartyCompare($a, $b, $strict = false, $invert = false) |
| 1879 | { |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1880 | $result = $strict ? $a === $b : $a == $b; |
| 1881 | return $invert ? !$result : $result; |
| 1881 | return $invert ? !$result : $result; |
| 1881 | return $invert ? !$result : $result; |
| 1882 | } |
| 1888 | public function smartyEscape($string, $esc_type = 'html', $char_set = 'ISO-8859-1') |
| 1889 | { |
| 1890 | $pattern = "/(:|\.|\[|\]|,|=|@)/"; |
| 1891 | $replacement = '\\\\\\\$1'; |
| 1892 | switch ($esc_type) { |
| 1893 | // Because jQuery uses CSS syntax for selecting elements |
| 1894 | // some characters are interpreted as CSS notation. |
| 1895 | // In order to tell jQuery to treat these characters literally rather |
| 1896 | // than as CSS notation, they must be escaped by placing two backslashes |
| 1897 | // in front of them. |
| 1898 | case 'jqselector': |
| 1903 | case 'jsid': |
| 1903 | case 'jsid': |
| 1909 | return smarty_modifier_escape($string, $esc_type, $char_set); |
| 1910 | } |
| 1911 | } |
| 1888 | public function smartyEscape($string, $esc_type = 'html', $char_set = 'ISO-8859-1') |
| 1889 | { |
| 1890 | $pattern = "/(:|\.|\[|\]|,|=|@)/"; |
| 1891 | $replacement = '\\\\\\\$1'; |
| 1892 | switch ($esc_type) { |
| 1893 | // Because jQuery uses CSS syntax for selecting elements |
| 1894 | // some characters are interpreted as CSS notation. |
| 1895 | // In order to tell jQuery to treat these characters literally rather |
| 1896 | // than as CSS notation, they must be escaped by placing two backslashes |
| 1897 | // in front of them. |
| 1898 | case 'jqselector': |
| 1903 | case 'jsid': |
| 1904 | $result = smarty_modifier_escape($string, 'javascript', $char_set); |
| 1905 | $result = preg_replace($pattern, $replacement, $result); |
| 1906 | return $result; |
| 1888 | public function smartyEscape($string, $esc_type = 'html', $char_set = 'ISO-8859-1') |
| 1889 | { |
| 1890 | $pattern = "/(:|\.|\[|\]|,|=|@)/"; |
| 1891 | $replacement = '\\\\\\\$1'; |
| 1892 | switch ($esc_type) { |
| 1893 | // Because jQuery uses CSS syntax for selecting elements |
| 1894 | // some characters are interpreted as CSS notation. |
| 1895 | // In order to tell jQuery to treat these characters literally rather |
| 1896 | // than as CSS notation, they must be escaped by placing two backslashes |
| 1897 | // in front of them. |
| 1898 | case 'jqselector': |
| 1899 | $result = smarty_modifier_escape($string, 'html', $char_set); |
| 1900 | $result = preg_replace($pattern, $replacement, $result); |
| 1901 | return $result; |
| 1641 | public function smartyFlush($params, $smarty) |
| 1642 | { |
| 1643 | $smarty->flush(); |
| 1644 | } |
| 1492 | public function smartyHelp($params, $smarty) |
| 1493 | { |
| 1494 | assert(isset($params['file'])); |
| 1495 | |
| 1496 | $params = array_merge( |
| 1497 | [ |
| 1498 | 'file' => null, // The name of the Markdown file |
| 1499 | 'section' => null, // The (optional) anchor within the Markdown file |
| 1500 | 'textKey' => 'help.help', // An (optional) locale key for the link |
| 1501 | 'text' => null, // An (optional) literal text for the link |
| 1502 | 'class' => null, // An (optional) CSS class string for the link |
| 1503 | ], |
| 1504 | $params |
| 1505 | ); |
| 1506 | |
| 1507 | $this->assign([ |
| 1508 | 'helpFile' => $params['file'], |
| 1509 | 'helpSection' => $params['section'], |
| 1510 | 'helpTextKey' => $params['textKey'], |
| 1511 | 'helpText' => $params['text'], |
| 1512 | 'helpClass' => $params['class'], |
| 1513 | ]); |
| 1514 | |
| 1515 | return $this->fetch('common/helpLink.tpl'); |
| 1516 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1531 | // Translate values AND output |
| 1532 | $newOptions = []; |
| 1533 | foreach ($params['options'] as $k => $v) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1539 | $params['options'] = array_map('__', $params['options']); |
| 1540 | } |
| 1541 | } |
| 1542 | |
| 1543 | if (isset($params['output'])) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1539 | $params['options'] = array_map('__', $params['options']); |
| 1540 | } |
| 1541 | } |
| 1542 | |
| 1543 | if (isset($params['output'])) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1539 | $params['options'] = array_map('__', $params['options']); |
| 1540 | } |
| 1541 | } |
| 1542 | |
| 1543 | if (isset($params['output'])) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1539 | $params['options'] = array_map('__', $params['options']); |
| 1540 | } |
| 1541 | } |
| 1542 | |
| 1543 | if (isset($params['output'])) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1539 | $params['options'] = array_map('__', $params['options']); |
| 1540 | } |
| 1541 | } |
| 1542 | |
| 1543 | if (isset($params['output'])) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1539 | $params['options'] = array_map('__', $params['options']); |
| 1540 | } |
| 1541 | } |
| 1542 | |
| 1543 | if (isset($params['output'])) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1539 | $params['options'] = array_map('__', $params['options']); |
| 1540 | } |
| 1541 | } |
| 1542 | |
| 1543 | if (isset($params['output'])) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1530 | if (isset($params['translateValues'])) { |
| 1539 | $params['options'] = array_map('__', $params['options']); |
| 1540 | } |
| 1541 | } |
| 1542 | |
| 1543 | if (isset($params['output'])) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1543 | if (isset($params['output'])) { |
| 1544 | $params['output'] = array_map('__', $params['output']); |
| 1545 | } |
| 1546 | |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1548 | $params['values'] = array_map('__', $params['values']); |
| 1549 | } |
| 1550 | |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1527 | public function smartyHtmlOptionsTranslate($params, $smarty) |
| 1528 | { |
| 1529 | if (isset($params['options'])) { |
| 1543 | if (isset($params['output'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1547 | if (isset($params['values']) && isset($params['translateValues'])) { |
| 1551 | require_once('lib/pkp/lib/vendor/smarty/smarty/libs/plugins/function.html_options.php'); |
| 1552 | /** @var Smarty_Internal_Template $smarty */ |
| 1553 | return smarty_function_html_options($params, $smarty); |
| 1554 | } |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1569 | if (empty($content)) { |
| 1570 | $smarty->assign($params['key'], 1); |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1579 | return $content; |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1569 | if (empty($content)) { |
| 1570 | $smarty->assign($params['key'], 1); |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1581 | $repeat = false; |
| 1582 | return ''; |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1569 | if (empty($content)) { |
| 1570 | $smarty->assign($params['key'], 1); |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1587 | if (isset($params['key'])) { |
| 1588 | [$key, $value] = $iterator->nextWithKey(); |
| 1596 | return $content; |
| 1597 | } |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1569 | if (empty($content)) { |
| 1570 | $smarty->assign($params['key'], 1); |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1594 | $smarty->assign($params['item'], $iterator->next()); |
| 1595 | } |
| 1596 | return $content; |
| 1596 | return $content; |
| 1597 | } |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1569 | if (empty($content)) { |
| 1570 | $smarty->assign($params['key'], 1); |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1579 | return $content; |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1569 | if (empty($content)) { |
| 1570 | $smarty->assign($params['key'], 1); |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1581 | $repeat = false; |
| 1582 | return ''; |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1569 | if (empty($content)) { |
| 1570 | $smarty->assign($params['key'], 1); |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1587 | if (isset($params['key'])) { |
| 1588 | [$key, $value] = $iterator->nextWithKey(); |
| 1596 | return $content; |
| 1597 | } |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1569 | if (empty($content)) { |
| 1570 | $smarty->assign($params['key'], 1); |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1594 | $smarty->assign($params['item'], $iterator->next()); |
| 1595 | } |
| 1596 | return $content; |
| 1596 | return $content; |
| 1597 | } |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1572 | $smarty->assign($params['key'], $smarty->getTemplateVars($params['key']) + 1); |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | // If the iterator is empty, we're finished. |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1579 | return $content; |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1572 | $smarty->assign($params['key'], $smarty->getTemplateVars($params['key']) + 1); |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | // If the iterator is empty, we're finished. |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1581 | $repeat = false; |
| 1582 | return ''; |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1572 | $smarty->assign($params['key'], $smarty->getTemplateVars($params['key']) + 1); |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | // If the iterator is empty, we're finished. |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1587 | if (isset($params['key'])) { |
| 1588 | [$key, $value] = $iterator->nextWithKey(); |
| 1596 | return $content; |
| 1597 | } |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1572 | $smarty->assign($params['key'], $smarty->getTemplateVars($params['key']) + 1); |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | // If the iterator is empty, we're finished. |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1594 | $smarty->assign($params['item'], $iterator->next()); |
| 1595 | } |
| 1596 | return $content; |
| 1596 | return $content; |
| 1597 | } |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1572 | $smarty->assign($params['key'], $smarty->getTemplateVars($params['key']) + 1); |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | // If the iterator is empty, we're finished. |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1579 | return $content; |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1572 | $smarty->assign($params['key'], $smarty->getTemplateVars($params['key']) + 1); |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | // If the iterator is empty, we're finished. |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1581 | $repeat = false; |
| 1582 | return ''; |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1572 | $smarty->assign($params['key'], $smarty->getTemplateVars($params['key']) + 1); |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | // If the iterator is empty, we're finished. |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1587 | if (isset($params['key'])) { |
| 1588 | [$key, $value] = $iterator->nextWithKey(); |
| 1596 | return $content; |
| 1597 | } |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1569 | if (empty($content)) { |
| 1572 | $smarty->assign($params['key'], $smarty->getTemplateVars($params['key']) + 1); |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | // If the iterator is empty, we're finished. |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1594 | $smarty->assign($params['item'], $iterator->next()); |
| 1595 | } |
| 1596 | return $content; |
| 1596 | return $content; |
| 1597 | } |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1579 | return $content; |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1581 | $repeat = false; |
| 1582 | return ''; |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1587 | if (isset($params['key'])) { |
| 1588 | [$key, $value] = $iterator->nextWithKey(); |
| 1596 | return $content; |
| 1597 | } |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1594 | $smarty->assign($params['item'], $iterator->next()); |
| 1595 | } |
| 1596 | return $content; |
| 1596 | return $content; |
| 1597 | } |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1579 | return $content; |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1578 | if (!$repeat) { |
| 1581 | $repeat = false; |
| 1582 | return ''; |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1587 | if (isset($params['key'])) { |
| 1588 | [$key, $value] = $iterator->nextWithKey(); |
| 1596 | return $content; |
| 1597 | } |
| 1564 | public function smartyIterate($params, $content, $smarty, &$repeat) |
| 1565 | { |
| 1566 | $iterator = $smarty->getTemplateVars($params['from']); |
| 1567 | |
| 1568 | if (isset($params['key'])) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1577 | if (!$iterator || $iterator->eof()) { |
| 1585 | $repeat = true; |
| 1586 | |
| 1587 | if (isset($params['key'])) { |
| 1594 | $smarty->assign($params['item'], $iterator->next()); |
| 1595 | } |
| 1596 | return $content; |
| 1596 | return $content; |
| 1597 | } |
| 2139 | public function smartyLoadHeader($params, $smarty) |
| 2140 | { |
| 2141 | if (empty($params['context'])) { |
| 2142 | $params['context'] = 'frontend'; |
| 2143 | } |
| 2144 | |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2146 | |
| 2147 | ksort($headers); |
| 2148 | |
| 2149 | $output = ''; |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2152 | $output .= "\n" . $data['header']; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | return $output; |
| 2157 | } |
| 2139 | public function smartyLoadHeader($params, $smarty) |
| 2140 | { |
| 2141 | if (empty($params['context'])) { |
| 2142 | $params['context'] = 'frontend'; |
| 2143 | } |
| 2144 | |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2146 | |
| 2147 | ksort($headers); |
| 2148 | |
| 2149 | $output = ''; |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2152 | $output .= "\n" . $data['header']; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | return $output; |
| 2157 | } |
| 2139 | public function smartyLoadHeader($params, $smarty) |
| 2140 | { |
| 2141 | if (empty($params['context'])) { |
| 2142 | $params['context'] = 'frontend'; |
| 2143 | } |
| 2144 | |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2146 | |
| 2147 | ksort($headers); |
| 2148 | |
| 2149 | $output = ''; |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2152 | $output .= "\n" . $data['header']; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | return $output; |
| 2157 | } |
| 2139 | public function smartyLoadHeader($params, $smarty) |
| 2140 | { |
| 2141 | if (empty($params['context'])) { |
| 2142 | $params['context'] = 'frontend'; |
| 2143 | } |
| 2144 | |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2146 | |
| 2147 | ksort($headers); |
| 2148 | |
| 2149 | $output = ''; |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2152 | $output .= "\n" . $data['header']; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | return $output; |
| 2157 | } |
| 2139 | public function smartyLoadHeader($params, $smarty) |
| 2140 | { |
| 2141 | if (empty($params['context'])) { |
| 2142 | $params['context'] = 'frontend'; |
| 2143 | } |
| 2144 | |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2146 | |
| 2147 | ksort($headers); |
| 2148 | |
| 2149 | $output = ''; |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2152 | $output .= "\n" . $data['header']; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | return $output; |
| 2157 | } |
| 2139 | public function smartyLoadHeader($params, $smarty) |
| 2140 | { |
| 2141 | if (empty($params['context'])) { |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2146 | |
| 2147 | ksort($headers); |
| 2148 | |
| 2149 | $output = ''; |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2152 | $output .= "\n" . $data['header']; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | return $output; |
| 2157 | } |
| 2139 | public function smartyLoadHeader($params, $smarty) |
| 2140 | { |
| 2141 | if (empty($params['context'])) { |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2146 | |
| 2147 | ksort($headers); |
| 2148 | |
| 2149 | $output = ''; |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2152 | $output .= "\n" . $data['header']; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | return $output; |
| 2157 | } |
| 2139 | public function smartyLoadHeader($params, $smarty) |
| 2140 | { |
| 2141 | if (empty($params['context'])) { |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2146 | |
| 2147 | ksort($headers); |
| 2148 | |
| 2149 | $output = ''; |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2152 | $output .= "\n" . $data['header']; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | return $output; |
| 2157 | } |
| 2139 | public function smartyLoadHeader($params, $smarty) |
| 2140 | { |
| 2141 | if (empty($params['context'])) { |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2146 | |
| 2147 | ksort($headers); |
| 2148 | |
| 2149 | $output = ''; |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2152 | $output .= "\n" . $data['header']; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | return $output; |
| 2157 | } |
| 2139 | public function smartyLoadHeader($params, $smarty) |
| 2140 | { |
| 2141 | if (empty($params['context'])) { |
| 2145 | $headers = $this->getResourcesByContext($this->_htmlHeaders, $params['context']); |
| 2146 | |
| 2147 | ksort($headers); |
| 2148 | |
| 2149 | $output = ''; |
| 2150 | foreach ($headers as $priorityList) { |
| 2150 | foreach ($headers as $priorityList) { |
| 2151 | foreach ($priorityList as $name => $data) { |
| 2152 | $output .= "\n" . $data['header']; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | return $output; |
| 2157 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2176 | $contextId = $currentContext->getId(); |
| 2177 | } |
| 2178 | |
| 2179 | // Don't load menus for an area that's not registered by the active theme |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2182 | $themePlugins = PluginRegistry::loadCategory('themes', true); |
| 2183 | } |
| 2184 | /** @var ThemePlugin[] $themePlugins */ |
| 2185 | $activeThemeNavigationAreas = []; |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2197 | $menuTemplatePath = $declaredMenuTemplatePath; |
| 2198 | } |
| 2199 | |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2205 | $navigationMenu = $navigationMenus[0]; |
| 2206 | app()->get('navigationMenu')->getMenuTree($navigationMenu); |
| 2207 | } |
| 2208 | |
| 2209 | |
| 2210 | $this->assign([ |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2169 | public function smartyLoadNavigationMenuArea($params, $smarty) |
| 2170 | { |
| 2171 | $areaName = $params['name']; |
| 2172 | $declaredMenuTemplatePath = $params['path'] ?? null; |
| 2173 | $currentContext = $this->_request->getContext(); |
| 2174 | $contextId = Application::SITE_CONTEXT_ID; |
| 2175 | if ($currentContext) { |
| 2180 | $themePlugins = PluginRegistry::getPlugins('themes'); |
| 2181 | if (empty($themePlugins)) { |
| 2185 | $activeThemeNavigationAreas = []; |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2186 | foreach ($themePlugins as $themePlugin) { |
| 2187 | if ($themePlugin->isActive()) { |
| 2188 | $areas = $themePlugin->getMenuAreas(); |
| 2189 | if (!in_array($areaName, $areas)) { |
| 2190 | return ''; |
| 2191 | } |
| 2192 | } |
| 2193 | } |
| 2194 | |
| 2195 | $menuTemplatePath = 'frontend/components/navigationMenu.tpl'; |
| 2196 | if (isset($declaredMenuTemplatePath)) { |
| 2200 | $navigationMenuDao = DAORegistry::getDAO('NavigationMenuDAO'); /** @var NavigationMenuDAO $navigationMenuDao */ |
| 2201 | |
| 2202 | $output = ''; |
| 2203 | $navigationMenus = $navigationMenuDao->getByArea($contextId, $areaName)->toArray(); |
| 2204 | if (isset($navigationMenus[0])) { |
| 2210 | $this->assign([ |
| 2211 | 'navigationMenu' => $navigationMenu, |
| 2212 | 'id' => $params['id'], |
| 2213 | 'ulClass' => $params['ulClass'] ?? '', |
| 2214 | 'liClass' => $params['liClass'] ?? '', |
| 2215 | ]); |
| 2216 | |
| 2217 | return $this->fetch($menuTemplatePath); |
| 2218 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2099 | $params['context'] = 'frontend'; |
| 2100 | } |
| 2101 | |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2103 | $appVersion = Application::get()->getCurrentVersion()->getVersionString(); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2096 | public function smartyLoadScript($params, $smarty) |
| 2097 | { |
| 2098 | if (empty($params['context'])) { |
| 2102 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2105 | $appVersion = null; |
| 2106 | } |
| 2107 | |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2108 | $scripts = $this->getResourcesByContext($this->_javaScripts, $params['context']); |
| 2109 | |
| 2110 | ksort($scripts); |
| 2111 | |
| 2112 | $output = ''; |
| 2113 | foreach ($scripts as $priorityList) { |
| 2113 | foreach ($scripts as $priorityList) { |
| 2114 | foreach ($priorityList as $name => $data) { |
| 2115 | if ($data['inline']) { |
| 2116 | $output .= '<script type="text/javascript">' . $data['script'] . '</script>'; |
| 2117 | } else { |
| 2118 | if ($appVersion && strpos($data['script'], '?') === false) { |
| 2119 | $data['script'] .= '?v=' . $appVersion; |
| 2120 | } |
| 2121 | $output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>'; |
| 2122 | } |
| 2123 | } |
| 2124 | } |
| 2125 | |
| 2126 | return $output; |
| 2127 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2009 | $params['context'] = 'frontend'; |
| 2010 | } |
| 2011 | |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2013 | $versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */ |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 2006 | public function smartyLoadStylesheet($params, $smarty) |
| 2007 | { |
| 2008 | if (empty($params['context'])) { |
| 2012 | if (!PKPSessionGuard::isSessionDisable()) { |
| 2016 | $appVersion = null; |
| 2017 | } |
| 2018 | |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2019 | $stylesheets = $this->getResourcesByContext($this->_styleSheets, $params['context']); |
| 2020 | |
| 2021 | ksort($stylesheets); |
| 2022 | |
| 2023 | $output = ''; |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2024 | foreach ($stylesheets as $priorityList) { |
| 2025 | foreach ($priorityList as $style) { |
| 2026 | if (!empty($style['inline'])) { |
| 2027 | $output .= '<style type="text/css">' . $style['style'] . '</style>'; |
| 2028 | } else { |
| 2029 | if ($appVersion && strpos($style['style'], '?') === false) { |
| 2030 | $style['style'] .= '?v=' . $appVersion; |
| 2031 | } |
| 2032 | $output .= '<link rel="stylesheet" href="' . $style['style'] . '" type="text/css" />'; |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | return $output; |
| 2038 | } |
| 1968 | public function smartyLoadUrlInDiv($params, $smarty) |
| 1969 | { |
| 1970 | $params['el'] = 'div'; |
| 1971 | return $this->smartyLoadUrlInEl($params, $smarty); |
| 1972 | } |
| 1923 | public function smartyLoadUrlInEl($params, $smarty) |
| 1924 | { |
| 1925 | // Required Params |
| 1926 | if (!isset($params['el'])) { |
| 1927 | throw new Exception('el parameter is missing from load_url_in_el'); |
| 1923 | public function smartyLoadUrlInEl($params, $smarty) |
| 1924 | { |
| 1925 | // Required Params |
| 1926 | if (!isset($params['el'])) { |
| 1929 | if (!isset($params['url'])) { |
| 1930 | throw new Exception('url parameter is missing from load_url_in_el'); |
| 1923 | public function smartyLoadUrlInEl($params, $smarty) |
| 1924 | { |
| 1925 | // Required Params |
| 1926 | if (!isset($params['el'])) { |
| 1929 | if (!isset($params['url'])) { |
| 1932 | if (!isset($params['id'])) { |
| 1933 | throw new Exception('id parameter is missing from load_url_in_el'); |
| 1923 | public function smartyLoadUrlInEl($params, $smarty) |
| 1924 | { |
| 1925 | // Required Params |
| 1926 | if (!isset($params['el'])) { |
| 1929 | if (!isset($params['url'])) { |
| 1932 | if (!isset($params['id'])) { |
| 1936 | $this->assign([ |
| 1937 | 'inEl' => $params['el'], |
| 1938 | 'inElUrl' => $params['url'], |
| 1939 | 'inElElId' => $params['id'], |
| 1940 | 'inElClass' => $params['class'] ?? null, |
| 1941 | 'inVueEl' => $params['inVueEl'] ?? null, |
| 1942 | 'refreshOn' => $params['refreshOn'] ?? null, |
| 1943 | ]); |
| 1944 | |
| 1945 | if (isset($params['placeholder'])) { |
| 1945 | if (isset($params['placeholder'])) { |
| 1946 | $this->assign('inElPlaceholder', $params['placeholder']); |
| 1954 | return $this->fetch('common/urlInEl.tpl'); |
| 1955 | } |
| 1923 | public function smartyLoadUrlInEl($params, $smarty) |
| 1924 | { |
| 1925 | // Required Params |
| 1926 | if (!isset($params['el'])) { |
| 1929 | if (!isset($params['url'])) { |
| 1932 | if (!isset($params['id'])) { |
| 1936 | $this->assign([ |
| 1937 | 'inEl' => $params['el'], |
| 1938 | 'inElUrl' => $params['url'], |
| 1939 | 'inElElId' => $params['id'], |
| 1940 | 'inElClass' => $params['class'] ?? null, |
| 1941 | 'inVueEl' => $params['inVueEl'] ?? null, |
| 1942 | 'refreshOn' => $params['refreshOn'] ?? null, |
| 1943 | ]); |
| 1944 | |
| 1945 | if (isset($params['placeholder'])) { |
| 1947 | } elseif (isset($params['loadMessageId'])) { |
| 1947 | } elseif (isset($params['loadMessageId'])) { |
| 1948 | $loadMessageId = $params['loadMessageId']; |
| 1954 | return $this->fetch('common/urlInEl.tpl'); |
| 1955 | } |
| 1923 | public function smartyLoadUrlInEl($params, $smarty) |
| 1924 | { |
| 1925 | // Required Params |
| 1926 | if (!isset($params['el'])) { |
| 1929 | if (!isset($params['url'])) { |
| 1932 | if (!isset($params['id'])) { |
| 1936 | $this->assign([ |
| 1937 | 'inEl' => $params['el'], |
| 1938 | 'inElUrl' => $params['url'], |
| 1939 | 'inElElId' => $params['id'], |
| 1940 | 'inElClass' => $params['class'] ?? null, |
| 1941 | 'inVueEl' => $params['inVueEl'] ?? null, |
| 1942 | 'refreshOn' => $params['refreshOn'] ?? null, |
| 1943 | ]); |
| 1944 | |
| 1945 | if (isset($params['placeholder'])) { |
| 1947 | } elseif (isset($params['loadMessageId'])) { |
| 1951 | $this->assign('inElPlaceholder', $this->fetch('common/loadingContainer.tpl')); |
| 1952 | } |
| 1953 | |
| 1954 | return $this->fetch('common/urlInEl.tpl'); |
| 1954 | return $this->fetch('common/urlInEl.tpl'); |
| 1955 | } |
| 2353 | public function smartyLocaleDirection($params, $smarty) |
| 2354 | { |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2357 | } |
| 2353 | public function smartyLocaleDirection($params, $smarty) |
| 2354 | { |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2357 | } |
| 2353 | public function smartyLocaleDirection($params, $smarty) |
| 2354 | { |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2357 | } |
| 2353 | public function smartyLocaleDirection($params, $smarty) |
| 2354 | { |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2355 | $locale = empty($params['locale']) ? Locale::getLocale() : $params['locale']; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2356 | return Locale::getMetadata($locale)?->isRightToLeft() ? 'rtl' : 'ltr'; |
| 2357 | } |
| 1605 | public function smartyPageInfo($params, $smarty) |
| 1606 | { |
| 1607 | $iterator = $params['iterator']; |
| 1608 | |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1610 | $itemsPerPage = $params['itemsPerPage']; |
| 1618 | $page = $iterator->getPage(); |
| 1619 | $pageCount = $iterator->getPageCount(); |
| 1620 | $itemTotal = $iterator->getCount(); |
| 1621 | |
| 1622 | if ($pageCount < 1) { |
| 1623 | return ''; |
| 1605 | public function smartyPageInfo($params, $smarty) |
| 1606 | { |
| 1607 | $iterator = $params['iterator']; |
| 1608 | |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1610 | $itemsPerPage = $params['itemsPerPage']; |
| 1618 | $page = $iterator->getPage(); |
| 1619 | $pageCount = $iterator->getPageCount(); |
| 1620 | $itemTotal = $iterator->getCount(); |
| 1621 | |
| 1622 | if ($pageCount < 1) { |
| 1626 | $from = (($page - 1) * $itemsPerPage) + 1; |
| 1627 | $to = min($itemTotal, $page * $itemsPerPage); |
| 1628 | |
| 1629 | return __('navigation.items', [ |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1631 | 'to' => $to, |
| 1632 | 'total' => $itemTotal |
| 1633 | ]); |
| 1634 | } |
| 1605 | public function smartyPageInfo($params, $smarty) |
| 1606 | { |
| 1607 | $iterator = $params['iterator']; |
| 1608 | |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1610 | $itemsPerPage = $params['itemsPerPage']; |
| 1618 | $page = $iterator->getPage(); |
| 1619 | $pageCount = $iterator->getPageCount(); |
| 1620 | $itemTotal = $iterator->getCount(); |
| 1621 | |
| 1622 | if ($pageCount < 1) { |
| 1626 | $from = (($page - 1) * $itemsPerPage) + 1; |
| 1627 | $to = min($itemTotal, $page * $itemsPerPage); |
| 1628 | |
| 1629 | return __('navigation.items', [ |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1631 | 'to' => $to, |
| 1632 | 'total' => $itemTotal |
| 1633 | ]); |
| 1634 | } |
| 1605 | public function smartyPageInfo($params, $smarty) |
| 1606 | { |
| 1607 | $iterator = $params['iterator']; |
| 1608 | |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1612 | $itemsPerPage = $smarty->getTemplateVars('itemsPerPage'); |
| 1613 | if (!is_numeric($itemsPerPage)) { |
| 1614 | $itemsPerPage = 25; |
| 1615 | } |
| 1616 | } |
| 1617 | |
| 1618 | $page = $iterator->getPage(); |
| 1618 | $page = $iterator->getPage(); |
| 1619 | $pageCount = $iterator->getPageCount(); |
| 1620 | $itemTotal = $iterator->getCount(); |
| 1621 | |
| 1622 | if ($pageCount < 1) { |
| 1623 | return ''; |
| 1605 | public function smartyPageInfo($params, $smarty) |
| 1606 | { |
| 1607 | $iterator = $params['iterator']; |
| 1608 | |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1612 | $itemsPerPage = $smarty->getTemplateVars('itemsPerPage'); |
| 1613 | if (!is_numeric($itemsPerPage)) { |
| 1614 | $itemsPerPage = 25; |
| 1615 | } |
| 1616 | } |
| 1617 | |
| 1618 | $page = $iterator->getPage(); |
| 1618 | $page = $iterator->getPage(); |
| 1619 | $pageCount = $iterator->getPageCount(); |
| 1620 | $itemTotal = $iterator->getCount(); |
| 1621 | |
| 1622 | if ($pageCount < 1) { |
| 1626 | $from = (($page - 1) * $itemsPerPage) + 1; |
| 1627 | $to = min($itemTotal, $page * $itemsPerPage); |
| 1628 | |
| 1629 | return __('navigation.items', [ |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1631 | 'to' => $to, |
| 1632 | 'total' => $itemTotal |
| 1633 | ]); |
| 1634 | } |
| 1605 | public function smartyPageInfo($params, $smarty) |
| 1606 | { |
| 1607 | $iterator = $params['iterator']; |
| 1608 | |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1612 | $itemsPerPage = $smarty->getTemplateVars('itemsPerPage'); |
| 1613 | if (!is_numeric($itemsPerPage)) { |
| 1614 | $itemsPerPage = 25; |
| 1615 | } |
| 1616 | } |
| 1617 | |
| 1618 | $page = $iterator->getPage(); |
| 1618 | $page = $iterator->getPage(); |
| 1619 | $pageCount = $iterator->getPageCount(); |
| 1620 | $itemTotal = $iterator->getCount(); |
| 1621 | |
| 1622 | if ($pageCount < 1) { |
| 1626 | $from = (($page - 1) * $itemsPerPage) + 1; |
| 1627 | $to = min($itemTotal, $page * $itemsPerPage); |
| 1628 | |
| 1629 | return __('navigation.items', [ |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1631 | 'to' => $to, |
| 1632 | 'total' => $itemTotal |
| 1633 | ]); |
| 1634 | } |
| 1605 | public function smartyPageInfo($params, $smarty) |
| 1606 | { |
| 1607 | $iterator = $params['iterator']; |
| 1608 | |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1612 | $itemsPerPage = $smarty->getTemplateVars('itemsPerPage'); |
| 1613 | if (!is_numeric($itemsPerPage)) { |
| 1618 | $page = $iterator->getPage(); |
| 1619 | $pageCount = $iterator->getPageCount(); |
| 1620 | $itemTotal = $iterator->getCount(); |
| 1621 | |
| 1622 | if ($pageCount < 1) { |
| 1623 | return ''; |
| 1605 | public function smartyPageInfo($params, $smarty) |
| 1606 | { |
| 1607 | $iterator = $params['iterator']; |
| 1608 | |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1612 | $itemsPerPage = $smarty->getTemplateVars('itemsPerPage'); |
| 1613 | if (!is_numeric($itemsPerPage)) { |
| 1618 | $page = $iterator->getPage(); |
| 1619 | $pageCount = $iterator->getPageCount(); |
| 1620 | $itemTotal = $iterator->getCount(); |
| 1621 | |
| 1622 | if ($pageCount < 1) { |
| 1626 | $from = (($page - 1) * $itemsPerPage) + 1; |
| 1627 | $to = min($itemTotal, $page * $itemsPerPage); |
| 1628 | |
| 1629 | return __('navigation.items', [ |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1631 | 'to' => $to, |
| 1632 | 'total' => $itemTotal |
| 1633 | ]); |
| 1634 | } |
| 1605 | public function smartyPageInfo($params, $smarty) |
| 1606 | { |
| 1607 | $iterator = $params['iterator']; |
| 1608 | |
| 1609 | if (isset($params['itemsPerPage'])) { |
| 1612 | $itemsPerPage = $smarty->getTemplateVars('itemsPerPage'); |
| 1613 | if (!is_numeric($itemsPerPage)) { |
| 1618 | $page = $iterator->getPage(); |
| 1619 | $pageCount = $iterator->getPageCount(); |
| 1620 | $itemTotal = $iterator->getCount(); |
| 1621 | |
| 1622 | if ($pageCount < 1) { |
| 1626 | $from = (($page - 1) * $itemsPerPage) + 1; |
| 1627 | $to = min($itemTotal, $page * $itemsPerPage); |
| 1628 | |
| 1629 | return __('navigation.items', [ |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1630 | 'from' => ($to === 0 ? 0 : $from), |
| 1631 | 'to' => $to, |
| 1632 | 'total' => $itemTotal |
| 1633 | ]); |
| 1634 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2277 | error_log('Smarty: {pluck_files} function called without required `assign` param. Called in ' . __FILE__ . ':' . __LINE__); |
| 2278 | return; |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2283 | error_log('Smarty: {pluck_files} function called without required `files` param. Called in ' . __FILE__ . ':' . __LINE__); |
| 2284 | $smarty->assign($params['assign'], []); |
| 2285 | return; |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2290 | error_log('Smarty: {pluck_files} function called without required `by` param. Called in ' . __FILE__ . ':' . __LINE__); |
| 2291 | $smarty->assign($params['assign'], []); |
| 2292 | return; |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2300 | error_log('Smarty: {pluck_files} function called without a valid `by` param. Called in ' . __FILE__ . ':' . __LINE__); |
| 2301 | $smarty->assign($params['assign'], []); |
| 2302 | return; |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2307 | error_log('Smarty: {pluck_files} function called without required `value` param. Called in ' . __FILE__ . ':' . __LINE__); |
| 2308 | $smarty->assign($params['assign'], []); |
| 2309 | return; |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2330 | case 'publicationFormat': |
| 2336 | case 'genre': |
| 2336 | case 'genre': |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2330 | case 'publicationFormat': |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2330 | case 'publicationFormat': |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2334 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2334 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2328 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 2273 | public function smartyPluckFiles($params, $smarty) |
| 2274 | { |
| 2275 | // The variable to assign the result to. |
| 2276 | if (empty($params['assign'])) { |
| 2282 | if (!is_array($params['files'])) { |
| 2289 | if (empty($params['by'])) { |
| 2299 | if (!in_array($params['by'], ['chapter','publicationFormat','fileExtension','genre'])) { |
| 2306 | if (!isset($params['value'])) { |
| 2312 | $matching_files = []; |
| 2313 | |
| 2314 | $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ |
| 2315 | foreach ($params['files'] as $file) { |
| 2315 | foreach ($params['files'] as $file) { |
| 2316 | switch ($params['by']) { |
| 2317 | case 'chapter': |
| 2318 | $genre = $genreDao->getById($file->getGenreId()); |
| 2319 | if (!$genre->getDependent() && method_exists($file, 'getChapterId')) { |
| 2320 | if ($params['value'] === 'any' && $file->getChapterId()) { |
| 2321 | $matching_files[] = $file; |
| 2322 | } elseif ($file->getChapterId() == $params['value']) { |
| 2323 | $matching_files[] = $file; |
| 2324 | } elseif ($params['value'] == 0 && !$file->getChapterId()) { |
| 2325 | $matching_files[] = $file; |
| 2326 | } |
| 2327 | } |
| 2328 | break; |
| 2329 | |
| 2330 | case 'publicationFormat': |
| 2331 | if ($file->getData('assocId') == $params['value']) { |
| 2332 | $matching_files[] = $file; |
| 2333 | } |
| 2334 | break; |
| 2335 | |
| 2336 | case 'genre': |
| 2337 | if ($file->getGenreId() == $params['value']) { |
| 2338 | $matching_files[] = $file; |
| 2339 | } |
| 2340 | break; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | $smarty->assign($params['assign'], $matching_files); |
| 2345 | } |
| 1667 | public function smartyRunHook(array $params): ?string |
| 1668 | { |
| 1669 | $output = null; |
| 1670 | |
| 1671 | // Don't pollute the parameter list with a redundant hook name |
| 1672 | $hookName = $params['name']; |
| 1673 | unset($params['name']); |
| 1674 | |
| 1675 | Hook::run($hookName, ['templateMgr' => $this, 'output' => &$output, ...$params]); |
| 1676 | return $output; |
| 1677 | } |
| 1769 | public function smartyTitle($parameters, $smarty): string |
| 1770 | { |
| 1771 | $page = $parameters['value'] ?? ''; |
| 1772 | if ($smarty->getTemplateVars('currentContext')) { |
| 1772 | if ($smarty->getTemplateVars('currentContext')) { |
| 1773 | $siteTitle = $smarty->getTemplateVars('currentContext')->getLocalizedData('name'); |
| 1780 | if (empty($parameters['value'])) { |
| 1781 | return $siteTitle; |
| 1769 | public function smartyTitle($parameters, $smarty): string |
| 1770 | { |
| 1771 | $page = $parameters['value'] ?? ''; |
| 1772 | if ($smarty->getTemplateVars('currentContext')) { |
| 1772 | if ($smarty->getTemplateVars('currentContext')) { |
| 1773 | $siteTitle = $smarty->getTemplateVars('currentContext')->getLocalizedData('name'); |
| 1780 | if (empty($parameters['value'])) { |
| 1784 | return $parameters['value'] . __('common.titleSeparator') . $siteTitle; |
| 1785 | } |
| 1769 | public function smartyTitle($parameters, $smarty): string |
| 1770 | { |
| 1771 | $page = $parameters['value'] ?? ''; |
| 1772 | if ($smarty->getTemplateVars('currentContext')) { |
| 1774 | } elseif ($smarty->getTemplateVars('siteTitle')) { |
| 1774 | } elseif ($smarty->getTemplateVars('siteTitle')) { |
| 1775 | $siteTitle = $smarty->getTemplateVars('siteTitle'); |
| 1780 | if (empty($parameters['value'])) { |
| 1781 | return $siteTitle; |
| 1769 | public function smartyTitle($parameters, $smarty): string |
| 1770 | { |
| 1771 | $page = $parameters['value'] ?? ''; |
| 1772 | if ($smarty->getTemplateVars('currentContext')) { |
| 1774 | } elseif ($smarty->getTemplateVars('siteTitle')) { |
| 1774 | } elseif ($smarty->getTemplateVars('siteTitle')) { |
| 1775 | $siteTitle = $smarty->getTemplateVars('siteTitle'); |
| 1780 | if (empty($parameters['value'])) { |
| 1784 | return $parameters['value'] . __('common.titleSeparator') . $siteTitle; |
| 1785 | } |
| 1769 | public function smartyTitle($parameters, $smarty): string |
| 1770 | { |
| 1771 | $page = $parameters['value'] ?? ''; |
| 1772 | if ($smarty->getTemplateVars('currentContext')) { |
| 1774 | } elseif ($smarty->getTemplateVars('siteTitle')) { |
| 1777 | $siteTitle = __('common.software'); |
| 1778 | } |
| 1779 | |
| 1780 | if (empty($parameters['value'])) { |
| 1780 | if (empty($parameters['value'])) { |
| 1781 | return $siteTitle; |
| 1769 | public function smartyTitle($parameters, $smarty): string |
| 1770 | { |
| 1771 | $page = $parameters['value'] ?? ''; |
| 1772 | if ($smarty->getTemplateVars('currentContext')) { |
| 1774 | } elseif ($smarty->getTemplateVars('siteTitle')) { |
| 1777 | $siteTitle = __('common.software'); |
| 1778 | } |
| 1779 | |
| 1780 | if (empty($parameters['value'])) { |
| 1780 | if (empty($parameters['value'])) { |
| 1784 | return $parameters['value'] . __('common.titleSeparator') . $siteTitle; |
| 1785 | } |
| 1468 | public function smartyTranslate(array $params, Smarty_Internal_Template $smarty): string |
| 1469 | { |
| 1470 | // Save reserved params before removing them |
| 1471 | $key = $params['key'] ?? ''; |
| 1472 | $count = $params['count'] ?? null; |
| 1473 | $locale = $params['locale'] ?? null; |
| 1474 | $variables = $params['params'] ?? []; |
| 1475 | // Remove reserved params |
| 1476 | unset($params['key'], $params['count'], $params['params'], $params['locale']); |
| 1477 | // Merge variables |
| 1478 | $variables = $params + $variables; |
| 1479 | // Decides between the simple/pluralized version |
| 1480 | return $count === null ? __($key, $variables, $locale) : __p($key, $count, $variables, $locale); |
| 1480 | return $count === null ? __($key, $variables, $locale) : __p($key, $count, $variables, $locale); |
| 1480 | return $count === null ? __($key, $variables, $locale) : __p($key, $count, $variables, $locale); |
| 1481 | } |
| 1468 | public function smartyTranslate(array $params, Smarty_Internal_Template $smarty): string |
| 1469 | { |
| 1470 | // Save reserved params before removing them |
| 1471 | $key = $params['key'] ?? ''; |
| 1472 | $count = $params['count'] ?? null; |
| 1473 | $locale = $params['locale'] ?? null; |
| 1474 | $variables = $params['params'] ?? []; |
| 1475 | // Remove reserved params |
| 1476 | unset($params['key'], $params['count'], $params['params'], $params['locale']); |
| 1477 | // Merge variables |
| 1478 | $variables = $params + $variables; |
| 1479 | // Decides between the simple/pluralized version |
| 1480 | return $count === null ? __($key, $variables, $locale) : __p($key, $count, $variables, $locale); |
| 1480 | return $count === null ? __($key, $variables, $locale) : __p($key, $count, $variables, $locale); |
| 1480 | return $count === null ? __($key, $variables, $locale) : __p($key, $count, $variables, $locale); |
| 1481 | } |